@malloydata/malloy 0.0.127-dev240305191049 → 0.0.127-dev240306172007

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -36,7 +36,7 @@ export declare class SnowflakeDialect extends Dialect {
36
36
  sqlFieldReference(alias: string, fieldName: string, fieldType: string, isNested: boolean, _isArray: boolean): string;
37
37
  sqlUnnestPipelineHead(isSingleton: boolean, sourceSQLExpression: string): string;
38
38
  sqlCreateFunction(_id: string, _funcText: string): string;
39
- sqlCreateFunctionCombineLastStage(_lastStageName: string): string;
39
+ sqlCreateFunctionCombineLastStage(lastStageName: string): string;
40
40
  sqlSelectAliasAsStruct(alias: string): string;
41
41
  sqlMaybeQuoteIdentifier(identifier: string): string;
42
42
  sqlCreateTableAsSelect(tableName: string, sql: string): string;
@@ -99,27 +99,8 @@ class SnowflakeDialect extends dialect_1.Dialect {
99
99
  return tablePath;
100
100
  }
101
101
  sqlGroupSetTable(groupSetCount) {
102
- return `CROSS JOIN (SELECT seq4() as group_set FROM TABLE(GENERATOR(ROWCOUNT => ${groupSetCount + 1}))) as group_set`;
102
+ return `SELECT index as group_set FROM TABLE(FLATTEN(ARRAY_GENERATE_RANGE(0, ${groupSetCount})))`;
103
103
  }
104
- /*
105
- // this just returns null in snowflake
106
- select
107
- any_value (t is not null) as av
108
- from
109
- (
110
- select
111
- case
112
- when group_set = 1 then 'one'
113
- end as t
114
- from
115
- (
116
- SELECT
117
- seq4 () as group_set
118
- FROM
119
- TABLE (GENERATOR (ROWCOUNT => 3))
120
- ) as tbl
121
- );
122
- */
123
104
  sqlAnyValue(groupSet, fieldName) {
124
105
  return `(ARRAY_AGG(CASE WHEN group_set=${groupSet} THEN ${fieldName} END) WITHIN GROUP (ORDER BY ${fieldName} ASC NULLS LAST))[0]`;
125
106
  }
@@ -227,8 +208,8 @@ class SnowflakeDialect extends dialect_1.Dialect {
227
208
  sqlCreateFunction(_id, _funcText) {
228
209
  throw new Error('not implemented yet');
229
210
  }
230
- sqlCreateFunctionCombineLastStage(_lastStageName) {
231
- throw new Error('not implemented yet');
211
+ sqlCreateFunctionCombineLastStage(lastStageName) {
212
+ return `SELECT ARRAY_AGG(OBJECT_CONSTRUCT(*)) FROM ${lastStageName}`;
232
213
  }
233
214
  sqlSelectAliasAsStruct(alias) {
234
215
  return `OBJECT_CONSTRUCT(${alias}.*)`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malloydata/malloy",
3
- "version": "0.0.127-dev240305191049",
3
+ "version": "0.0.127-dev240306172007",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",