@malloydata/render 0.0.127-dev240307031210 → 0.0.127-dev240309202055
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.
|
@@ -652,6 +652,8 @@
|
|
|
652
652
|
var Dialect = class {
|
|
653
653
|
constructor() {
|
|
654
654
|
this.cantPartitionWindowFunctionsOnExpressions = false;
|
|
655
|
+
this.supportsPipelinesInViews = true;
|
|
656
|
+
this.supportsArraysInData = true;
|
|
655
657
|
}
|
|
656
658
|
sqlFinalStage(_lastStageName, _fields) {
|
|
657
659
|
throw new Error("Dialect has no final Stage but called Anyway");
|
|
@@ -5109,13 +5111,15 @@ ${hackSplitComment}
|
|
|
5109
5111
|
this.dontUnionIndex = false;
|
|
5110
5112
|
this.supportsQualify = false;
|
|
5111
5113
|
this.supportsNesting = true;
|
|
5114
|
+
this.supportsPipelinesInViews = false;
|
|
5115
|
+
this.supportsArraysInData = false;
|
|
5112
5116
|
}
|
|
5113
5117
|
// don't mess with the table pathing.
|
|
5114
5118
|
quoteTablePath(tablePath) {
|
|
5115
5119
|
return tablePath;
|
|
5116
5120
|
}
|
|
5117
5121
|
sqlGroupSetTable(groupSetCount) {
|
|
5118
|
-
return `SELECT index as group_set FROM TABLE(FLATTEN(ARRAY_GENERATE_RANGE(0, ${groupSetCount})))`;
|
|
5122
|
+
return `CROSS JOIN (SELECT index as group_set FROM TABLE(FLATTEN(ARRAY_GENERATE_RANGE(0, ${groupSetCount + 1}))))`;
|
|
5119
5123
|
}
|
|
5120
5124
|
sqlAnyValue(groupSet, fieldName) {
|
|
5121
5125
|
return `(ARRAY_AGG(CASE WHEN group_set=${groupSet} THEN ${fieldName} END) WITHIN GROUP (ORDER BY ${fieldName} ASC NULLS LAST))[0]`;
|
|
@@ -5130,7 +5134,7 @@ ${hackSplitComment}
|
|
|
5130
5134
|
sqlAggregateTurtle(groupSet, fieldList, orderBy, limit) {
|
|
5131
5135
|
const fields = this.mapFieldsForObjectConstruct(fieldList);
|
|
5132
5136
|
const orderByClause = orderBy ? ` WITHIN GROUP (${orderBy})` : "";
|
|
5133
|
-
const aggClause = `ARRAY_AGG(CASE WHEN group_set=${groupSet} THEN
|
|
5137
|
+
const aggClause = `ARRAY_AGG(CASE WHEN group_set=${groupSet} THEN OBJECT_CONSTRUCT_KEEP_NULL(${fields}) END)${orderByClause}`;
|
|
5134
5138
|
if (limit === void 0) {
|
|
5135
5139
|
return `COALESCE(${aggClause}, [])`;
|
|
5136
5140
|
}
|
|
@@ -5138,7 +5142,7 @@ ${hackSplitComment}
|
|
|
5138
5142
|
}
|
|
5139
5143
|
sqlAnyValueTurtle(groupSet, fieldList) {
|
|
5140
5144
|
const fields = this.mapFieldsForObjectConstruct(fieldList);
|
|
5141
|
-
return `(ARRAY_AGG(CASE WHEN group_set=${groupSet} THEN
|
|
5145
|
+
return `(ARRAY_AGG(CASE WHEN group_set=${groupSet} THEN OBJECT_CONSTRUCT_KEEP_NULL(${fields}) END) WITHIN GROUP (ORDER BY 1 ASC NULLS LAST))[0]`;
|
|
5142
5146
|
}
|
|
5143
5147
|
sqlAnyValueLastTurtle(name, groupSet, sqlName) {
|
|
5144
5148
|
return `(ARRAY_AGG(CASE WHEN group_set=${groupSet} THEN ${name} END) WITHIN GROUP (ORDER BY ${name} ASC NULLS LAST))[0] AS ${sqlName}`;
|
|
@@ -5146,7 +5150,7 @@ ${hackSplitComment}
|
|
|
5146
5150
|
sqlCoaleseMeasuresInline(groupSet, fieldList) {
|
|
5147
5151
|
const fields = this.mapFieldsForObjectConstruct(fieldList);
|
|
5148
5152
|
const nullValues = fieldList.map((f4) => `'${f4.sqlOutputName}', NULL`).join(", ");
|
|
5149
|
-
return `COALESCE(ARRAY_AGG(CASE WHEN group_set=${groupSet} THEN
|
|
5153
|
+
return `COALESCE(ARRAY_AGG(CASE WHEN group_set=${groupSet} THEN OBJECT_CONSTRUCT_KEEP_NULL(${fields}) END)[0], OBJECT_CONSTRUCT_KEEP_NULL(${nullValues}))`;
|
|
5150
5154
|
}
|
|
5151
5155
|
sqlUnnestAlias(source3, alias, _fieldList, _needDistinctKey, isArray2, _isInNestedPipeline) {
|
|
5152
5156
|
if (isArray2) {
|
|
@@ -5192,6 +5196,8 @@ ${hackSplitComment}
|
|
|
5192
5196
|
let snowflakeType = fieldType;
|
|
5193
5197
|
if (fieldType === "string") {
|
|
5194
5198
|
snowflakeType = "varchar";
|
|
5199
|
+
} else if (fieldType === "struct") {
|
|
5200
|
+
snowflakeType = "variant";
|
|
5195
5201
|
}
|
|
5196
5202
|
return `${alias}.value:"${fieldName}"::${snowflakeType}`;
|
|
5197
5203
|
}
|
|
@@ -5206,11 +5212,11 @@ ${hackSplitComment}
|
|
|
5206
5212
|
sqlCreateFunction(_id, _funcText) {
|
|
5207
5213
|
throw new Error("not implemented yet");
|
|
5208
5214
|
}
|
|
5209
|
-
sqlCreateFunctionCombineLastStage(
|
|
5210
|
-
|
|
5215
|
+
sqlCreateFunctionCombineLastStage(_lastStageName) {
|
|
5216
|
+
throw new Error("not implemented yet");
|
|
5211
5217
|
}
|
|
5212
5218
|
sqlSelectAliasAsStruct(alias) {
|
|
5213
|
-
return `
|
|
5219
|
+
return `OBJECT_CONSTRUCT_KEEP_NULL(${alias}.*)`;
|
|
5214
5220
|
}
|
|
5215
5221
|
sqlMaybeQuoteIdentifier(identifier) {
|
|
5216
5222
|
return `"${identifier}"`;
|
|
@@ -71282,6 +71288,9 @@ ${errText}`, errors);
|
|
|
71282
71288
|
quote(column) {
|
|
71283
71289
|
return (0, dialect_1.getDialect)(this.connection.dialectName).sqlMaybeQuoteIdentifier(column);
|
|
71284
71290
|
}
|
|
71291
|
+
get dialect() {
|
|
71292
|
+
return (0, dialect_1.getDialect)(this.connection.dialectName);
|
|
71293
|
+
}
|
|
71285
71294
|
getQuoter() {
|
|
71286
71295
|
return (x6) => this.quote(x6.toString());
|
|
71287
71296
|
}
|