@malloydata/malloy 0.0.138-dev240402223657 → 0.0.138-dev240403155507

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.
@@ -204,7 +204,7 @@ class TrinoDialect extends dialect_1.Dialect {
204
204
  if (f.isArray) {
205
205
  s = `array(${s})`;
206
206
  }
207
- fields.push(s);
207
+ fields.push(`${f.sqlOutputName} ${s}`);
208
208
  }
209
209
  else {
210
210
  fields.push(`${f.sqlOutputName} ${trinoTypeMap[f.type] || f.type}`);
@@ -216,7 +216,7 @@ class TrinoDialect extends dialect_1.Dialect {
216
216
  sqlAggregateTurtle(groupSet, fieldList, orderBy, limit) {
217
217
  const expressions = fieldList.map(f => f.sqlExpression).join(',\n ');
218
218
  const definitions = this.buildTypeExpression(fieldList);
219
- let ret = `ARRAY_AGG(CASE WHEN group_set=${groupSet} THEN CAST(ROW(${expressions}) AS ROW(${definitions})) END ${orderBy})`;
219
+ let ret = `ARRAY_AGG(CAST(ROW(${expressions}) AS ROW(${definitions})) ${orderBy}) FILTER (WHERE group_set=${groupSet})`;
220
220
  if (limit !== undefined) {
221
221
  ret = `SLICE(${ret}, 1, ${limit})`;
222
222
  }
@@ -365,7 +365,7 @@ ${(0, utils_1.indent)(sql)}
365
365
  const dstType = typeof cast.dstType === 'string'
366
366
  ? this.malloyTypeToSQLType({ type: cast.dstType })
367
367
  : cast.dstType.raw;
368
- const castFunc = cast.safe ? 'SAFE_CAST' : 'CAST';
368
+ const castFunc = cast.safe ? 'TRY_CAST' : 'CAST';
369
369
  return (0, malloy_types_1.mkExpr) `${castFunc}(${cast.expr} AS ${dstType})`;
370
370
  }
371
371
  return cast.expr;
@@ -436,12 +436,10 @@ ${(0, utils_1.indent)(sql)}
436
436
  return tableSQL;
437
437
  }
438
438
  sqlLiteralString(literal) {
439
- const noVirgule = literal.replace(/\\/g, '\\\\');
440
- return "'" + noVirgule.replace(/'/g, "\\'") + "'";
439
+ return "'" + literal.replace(/'/g, "''") + "'";
441
440
  }
442
441
  sqlLiteralRegexp(literal) {
443
- const noVirgule = literal.replace(/\\/g, '\\\\');
444
- return "'" + noVirgule.replace(/'/g, "\\'") + "'";
442
+ return "'" + literal.replace(/'/g, "''") + "'";
445
443
  }
446
444
  getGlobalFunctionDef(name) {
447
445
  // TODO: implement
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malloydata/malloy",
3
- "version": "0.0.138-dev240402223657",
3
+ "version": "0.0.138-dev240403155507",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",