@malloydata/malloy 0.0.138-dev240401005446 → 0.0.138-dev240401194552

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.
@@ -77,7 +77,7 @@ class TrinoDialect extends dialect_1.Dialect {
77
77
  this.supportsQualify = true;
78
78
  this.supportsSafeCast = true;
79
79
  this.supportsNesting = true;
80
- this.cantPartitionWindowFunctionsOnExpressions = true;
80
+ this.cantPartitionWindowFunctionsOnExpressions = false;
81
81
  this.orderByClause = 'output_name';
82
82
  // TODO(figutierrez): update.
83
83
  this.keywords = `
@@ -232,13 +232,10 @@ class TrinoDialect extends dialect_1.Dialect {
232
232
  return `ANY_VALUE(CASE WHEN group_set=${groupSet} THEN ${name} END) as ${sqlName}`;
233
233
  }
234
234
  sqlCoaleseMeasuresInline(groupSet, fieldList) {
235
- const fields = fieldList
236
- .map(f => `${f.sqlExpression} as ${f.sqlOutputName}`)
237
- .join(', ');
238
- const nullValues = fieldList
239
- .map(f => `NULL as ${f.sqlOutputName}`)
240
- .join(', ');
241
- return `COALESCE(ANY_VALUE(CASE WHEN group_set=${groupSet} THEN STRUCT(${fields}) END), STRUCT(${nullValues}))`;
235
+ const fields = fieldList.map(f => f.sqlExpression).join(', ');
236
+ const nullValues = fieldList.map(_f => 'NULL').join(', ');
237
+ const definitions = this.buildTypeExpression(fieldList);
238
+ return `COALESCE(ANY_VALUE(CASE WHEN group_set=${groupSet} THEN CAST(ROW(${fields}) AS ROW(${definitions})) END), CAST(ROW(${nullValues}) AS ROW(${definitions})))`;
242
239
  }
243
240
  //
244
241
  // this code used to be:
@@ -309,12 +306,7 @@ ${(0, utils_1.indent)(sql)}
309
306
  return `(SELECT AS STRUCT ${alias}.*)`;
310
307
  }
311
308
  sqlMaybeQuoteIdentifier(identifier) {
312
- // return this.keywords.indexOf(identifier.toUpperCase()) > 0
313
- // ? '`' + identifier + '`'
314
- // : identifier;
315
- return identifier;
316
- // TODO: may need to escape;
317
- //return `"${identifier}"`;
309
+ return '"' + identifier + '"';
318
310
  }
319
311
  sqlNow() {
320
312
  return (0, malloy_types_1.mkExpr) `CURRENT_TIMESTAMP()`;
@@ -2105,7 +2105,7 @@ class QueryQuery extends QueryField {
2105
2105
  o.push(`${fi.fieldUsage.resultIndex} ${f.dir || 'ASC'}`);
2106
2106
  }
2107
2107
  else if (this.parent.dialect.orderByClause === 'output_name') {
2108
- o.push(`${f.field}${f.dir || 'ASC'}`);
2108
+ o.push(`${this.parent.dialect.sqlMaybeQuoteIdentifier(f.field)} ${f.dir || 'ASC'}`);
2109
2109
  }
2110
2110
  }
2111
2111
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malloydata/malloy",
3
- "version": "0.0.138-dev240401005446",
3
+ "version": "0.0.138-dev240401194552",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",