@malloydata/malloy 0.0.177-dev240828173040 → 0.0.177-dev240829030921

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.
Files changed (121) hide show
  1. package/dist/dialect/dialect.d.ts +23 -13
  2. package/dist/dialect/dialect.js +33 -27
  3. package/dist/dialect/duckdb/duckdb.d.ts +7 -11
  4. package/dist/dialect/duckdb/duckdb.js +34 -100
  5. package/dist/dialect/duckdb/functions/greatest_and_least.js +5 -12
  6. package/dist/dialect/functions/concat.js +1 -1
  7. package/dist/dialect/functions/greatest_and_least.js +1 -1
  8. package/dist/dialect/functions/simple_numeric_functions.js +1 -1
  9. package/dist/dialect/functions/sql.js +5 -15
  10. package/dist/dialect/functions/string_agg.js +2 -2
  11. package/dist/dialect/functions/trim_functions.js +2 -2
  12. package/dist/dialect/functions/util.d.ts +6 -9
  13. package/dist/dialect/functions/util.js +29 -38
  14. package/dist/dialect/index.d.ts +1 -1
  15. package/dist/dialect/index.js +1 -2
  16. package/dist/dialect/pg_impl.d.ts +15 -0
  17. package/dist/dialect/pg_impl.js +91 -0
  18. package/dist/dialect/postgres/functions/greatest_and_least.js +1 -3
  19. package/dist/dialect/postgres/functions/string_agg.js +2 -2
  20. package/dist/dialect/postgres/postgres.d.ts +7 -11
  21. package/dist/dialect/postgres/postgres.js +29 -92
  22. package/dist/dialect/snowflake/functions/string_agg.js +2 -2
  23. package/dist/dialect/snowflake/snowflake.d.ts +9 -9
  24. package/dist/dialect/snowflake/snowflake.js +41 -48
  25. package/dist/dialect/standardsql/functions/string_agg.js +4 -4
  26. package/dist/dialect/standardsql/standardsql.d.ts +9 -9
  27. package/dist/dialect/standardsql/standardsql.js +56 -51
  28. package/dist/dialect/trino/functions/concat.js +1 -1
  29. package/dist/dialect/trino/functions/string_agg.js +2 -2
  30. package/dist/dialect/trino/trino.d.ts +11 -12
  31. package/dist/dialect/trino/trino.js +59 -83
  32. package/dist/index.d.ts +3 -3
  33. package/dist/index.js +3 -4
  34. package/dist/lang/ast/ast-utils.d.ts +1 -1
  35. package/dist/lang/ast/ast-utils.js +2 -2
  36. package/dist/lang/ast/expressions/apply.js +1 -2
  37. package/dist/lang/ast/expressions/binary-boolean.d.ts +2 -1
  38. package/dist/lang/ast/expressions/binary-boolean.js +6 -3
  39. package/dist/lang/ast/expressions/binary-numeric.d.ts +2 -1
  40. package/dist/lang/ast/expressions/boolean.js +1 -1
  41. package/dist/lang/ast/expressions/constant-expression.d.ts +3 -3
  42. package/dist/lang/ast/expressions/constant-expression.js +0 -23
  43. package/dist/lang/ast/expressions/expr-aggregate-function.js +24 -34
  44. package/dist/lang/ast/expressions/expr-alternation-tree.d.ts +6 -3
  45. package/dist/lang/ast/expressions/expr-alternation-tree.js +10 -5
  46. package/dist/lang/ast/expressions/expr-cast.js +1 -2
  47. package/dist/lang/ast/expressions/expr-coalesce.js +4 -1
  48. package/dist/lang/ast/expressions/expr-compare.d.ts +3 -3
  49. package/dist/lang/ast/expressions/expr-count-distinct.js +1 -1
  50. package/dist/lang/ast/expressions/expr-count.js +3 -3
  51. package/dist/lang/ast/expressions/expr-func.js +15 -18
  52. package/dist/lang/ast/expressions/expr-granular-time.js +8 -10
  53. package/dist/lang/ast/expressions/expr-id-reference.js +2 -2
  54. package/dist/lang/ast/expressions/expr-minus.js +5 -4
  55. package/dist/lang/ast/expressions/expr-not.js +1 -1
  56. package/dist/lang/ast/expressions/expr-now.js +1 -6
  57. package/dist/lang/ast/expressions/expr-null.js +1 -1
  58. package/dist/lang/ast/expressions/expr-number.js +1 -1
  59. package/dist/lang/ast/expressions/expr-parens.js +1 -1
  60. package/dist/lang/ast/expressions/expr-props.js +4 -7
  61. package/dist/lang/ast/expressions/expr-regex.js +1 -3
  62. package/dist/lang/ast/expressions/expr-string.js +1 -7
  63. package/dist/lang/ast/expressions/expr-time-extract.js +12 -16
  64. package/dist/lang/ast/expressions/expr-time.d.ts +2 -2
  65. package/dist/lang/ast/expressions/expr-time.js +4 -6
  66. package/dist/lang/ast/expressions/expr-ungroup.js +2 -2
  67. package/dist/lang/ast/expressions/for-range.d.ts +2 -1
  68. package/dist/lang/ast/expressions/function-ordering.js +5 -5
  69. package/dist/lang/ast/expressions/partial-compare.d.ts +3 -3
  70. package/dist/lang/ast/expressions/pick-when.js +24 -8
  71. package/dist/lang/ast/expressions/range.d.ts +2 -1
  72. package/dist/lang/ast/expressions/range.js +4 -2
  73. package/dist/lang/ast/expressions/time-literal.d.ts +4 -3
  74. package/dist/lang/ast/expressions/time-literal.js +5 -10
  75. package/dist/lang/ast/expressions/top-by.js +1 -2
  76. package/dist/lang/ast/expressions/utils.d.ts +3 -12
  77. package/dist/lang/ast/expressions/utils.js +8 -56
  78. package/dist/lang/ast/field-space/reference-field.js +1 -1
  79. package/dist/lang/ast/index.d.ts +1 -1
  80. package/dist/lang/ast/index.js +1 -1
  81. package/dist/lang/ast/query-builders/index-builder.d.ts +2 -2
  82. package/dist/lang/ast/query-builders/reduce-builder.d.ts +2 -2
  83. package/dist/lang/ast/query-items/field-declaration.js +1 -5
  84. package/dist/lang/ast/query-properties/filters.d.ts +3 -3
  85. package/dist/lang/ast/query-properties/filters.js +6 -5
  86. package/dist/lang/ast/query-properties/top.js +1 -2
  87. package/dist/lang/ast/source-elements/refined-source.js +1 -1
  88. package/dist/lang/ast/source-properties/joins.js +11 -10
  89. package/dist/lang/ast/time-utils.d.ts +5 -7
  90. package/dist/lang/ast/time-utils.js +17 -57
  91. package/dist/lang/ast/types/binary_operators.d.ts +9 -0
  92. package/dist/lang/ast/types/binary_operators.js +28 -0
  93. package/dist/lang/ast/types/expr-result.d.ts +3 -3
  94. package/dist/lang/ast/types/expression-def.d.ts +4 -3
  95. package/dist/lang/ast/types/expression-def.js +43 -50
  96. package/dist/lang/lib/Malloy/MalloyParser.d.ts +0 -11
  97. package/dist/lang/lib/Malloy/MalloyParser.js +803 -858
  98. package/dist/lang/lib/Malloy/MalloyParserListener.d.ts +0 -13
  99. package/dist/lang/lib/Malloy/MalloyParserVisitor.d.ts +0 -8
  100. package/dist/lang/malloy-to-ast.d.ts +0 -1
  101. package/dist/lang/malloy-to-ast.js +0 -4
  102. package/dist/lang/test/expressions.spec.js +42 -86
  103. package/dist/lang/test/field-symbols.spec.js +8 -6
  104. package/dist/lang/test/literals.spec.js +6 -6
  105. package/dist/lang/test/model_serialization.spec.js +5 -5
  106. package/dist/lang/test/test-translator.js +9 -7
  107. package/dist/malloy.d.ts +3 -3
  108. package/dist/malloy.js +1 -1
  109. package/dist/model/index.d.ts +1 -1
  110. package/dist/model/index.js +2 -1
  111. package/dist/model/malloy_query.d.ts +24 -19
  112. package/dist/model/malloy_query.js +272 -244
  113. package/dist/model/malloy_types.d.ts +224 -205
  114. package/dist/model/malloy_types.js +19 -98
  115. package/dist/model/utils.d.ts +10 -3
  116. package/dist/model/utils.js +84 -219
  117. package/package.json +1 -1
  118. package/dist/lang/ast/types/comparison.d.ts +0 -11
  119. package/dist/lang/ast/types/comparison.js +0 -41
  120. package/dist/lang/ast/types/equality.d.ts +0 -7
  121. package/dist/lang/ast/types/equality.js +0 -37
@@ -300,46 +300,48 @@ ${(0, utils_1.indent)(sql)}
300
300
  // : identifier;
301
301
  return '`' + identifier + '`';
302
302
  }
303
- sqlNow() {
304
- return (0, malloy_types_1.mkExpr) `CURRENT_TIMESTAMP()`;
303
+ sqlNowExpr() {
304
+ return 'CURRENT_TIMESTAMP()';
305
305
  }
306
- sqlTrunc(qi, sqlTime, units) {
306
+ sqlTruncExpr(qi, trunc) {
307
307
  const tz = qtz(qi);
308
308
  const tzAdd = tz ? `, "${tz}"` : '';
309
- if (sqlTime.valueType === 'date') {
310
- if (dateMeasureable(units)) {
311
- return (0, malloy_types_1.mkExpr) `DATE_TRUNC(${sqlTime.value},${units})`;
309
+ if (trunc.e.dataType === 'date') {
310
+ if (dateMeasureable(trunc.units)) {
311
+ return `DATE_TRUNC(${trunc.e.sql},${trunc.units})`;
312
312
  }
313
- return (0, malloy_types_1.mkExpr) `TIMESTAMP(${sqlTime.value}${tzAdd})`;
313
+ return `TIMESTAMP(${trunc.e.sql}${tzAdd})`;
314
314
  }
315
- return (0, malloy_types_1.mkExpr) `TIMESTAMP_TRUNC(${sqlTime.value},${units}${tzAdd})`;
315
+ return `TIMESTAMP_TRUNC(${trunc.e.sql},${trunc.units}${tzAdd})`;
316
316
  }
317
- sqlExtract(qi, expr, units) {
318
- const extractTo = extractMap[units] || units;
319
- const tz = expr.valueType === 'timestamp' && qtz(qi);
317
+ sqlTimeExtractExpr(qi, te) {
318
+ const extractTo = extractMap[te.units] || te.units;
319
+ const tz = te.e.dataType === 'timestamp' && qtz(qi);
320
320
  const tzAdd = tz ? ` AT TIME ZONE '${tz}'` : '';
321
- return (0, malloy_types_1.mkExpr) `EXTRACT(${extractTo} FROM ${expr.value}${tzAdd})`;
321
+ return `EXTRACT(${extractTo} FROM ${te.e.sql}${tzAdd})`;
322
322
  }
323
- sqlAlterTime(op, expr, n, timeframe) {
324
- let theTime = expr.value;
325
- let computeType = expr.valueType;
326
- if (timeframe !== 'day' && timestampMeasureable(timeframe)) {
323
+ sqlAlterTimeExpr(df) {
324
+ const from = df.kids.base;
325
+ let dataType = from.dataType;
326
+ let sql = from.sql;
327
+ if (df.units !== 'day' && timestampMeasureable(df.units)) {
327
328
  // The units must be done in timestamp, no matter the input type
328
- computeType = 'timestamp';
329
- if (expr.valueType !== 'timestamp') {
330
- theTime = (0, malloy_types_1.mkExpr) `TIMESTAMP(${theTime})`;
329
+ if (dataType !== 'timestamp') {
330
+ sql = `TIMESTAMP(${sql})`;
331
+ dataType = 'timestamp';
331
332
  }
332
333
  }
333
- else if (expr.valueType === 'timestamp') {
334
- theTime = (0, malloy_types_1.mkExpr) `DATETIME(${theTime})`;
335
- computeType = 'datetime';
334
+ else if (dataType === 'timestamp') {
335
+ sql = `DATETIME(${sql})`;
336
+ dataType = 'datetime';
336
337
  }
337
- const funcName = computeType.toUpperCase() + (op === '+' ? '_ADD' : '_SUB');
338
- const newTime = (0, malloy_types_1.mkExpr) `${funcName}(${theTime}, INTERVAL ${n} ${timeframe})`;
339
- if (computeType === expr.valueType) {
338
+ const funcTail = df.op === '+' ? '_ADD' : '_SUB';
339
+ const funcName = `${dataType.toUpperCase()}${funcTail}`;
340
+ const newTime = `${funcName}(${sql}, INTERVAL ${df.kids.delta.sql} ${df.units})`;
341
+ if (dataType === from.dataType) {
340
342
  return newTime;
341
343
  }
342
- return (0, malloy_types_1.mkExpr) `${expr.valueType.toUpperCase()}(${newTime})`;
344
+ return `${from.dataType.toUpperCase()}(${newTime})`;
343
345
  }
344
346
  ignoreInProject(fieldName) {
345
347
  return fieldName === '_PARTITIONTIME';
@@ -347,41 +349,42 @@ ${(0, utils_1.indent)(sql)}
347
349
  sqlCast(qi, cast) {
348
350
  const op = `${cast.srcType}::${cast.dstType}`;
349
351
  const tz = qtz(qi);
352
+ const src = cast.e.sql || '';
350
353
  if (op === 'timestamp::date' && tz) {
351
- return (0, malloy_types_1.mkExpr) `DATE(${cast.expr},'${tz}')`;
354
+ return `DATE(${src},'${tz}')`;
352
355
  }
353
356
  if (op === 'date::timestamp' && tz) {
354
- return (0, malloy_types_1.mkExpr) `TIMESTAMP(${cast.expr}, '${tz}')`;
357
+ return `TIMESTAMP(${src}, '${tz}')`;
355
358
  }
356
359
  if (cast.srcType !== cast.dstType) {
357
360
  const dstType = typeof cast.dstType === 'string'
358
361
  ? this.malloyTypeToSQLType({ type: cast.dstType })
359
362
  : cast.dstType.raw;
360
363
  const castFunc = cast.safe ? 'SAFE_CAST' : 'CAST';
361
- return (0, malloy_types_1.mkExpr) `${castFunc}(${cast.expr} AS ${dstType})`;
364
+ return `${castFunc}(${src} AS ${dstType})`;
362
365
  }
363
- return cast.expr;
366
+ return src;
364
367
  }
365
- sqlRegexpMatch(expr, regexp) {
366
- return (0, malloy_types_1.mkExpr) `REGEXP_CONTAINS(${expr}, ${regexp})`;
368
+ sqlRegexpMatch(match) {
369
+ return `REGEXP_CONTAINS(${match.kids.expr.sql},${match.kids.regex.sql})`;
367
370
  }
368
- sqlLiteralTime(qi, timeString, type, timezone) {
369
- if (type === 'date') {
370
- return `DATE('${timeString}')`;
371
+ sqlLiteralTime(qi, lit) {
372
+ if (lit.dataType === 'date') {
373
+ return `DATE('${lit.literal}')`;
371
374
  }
372
- else if (type === 'timestamp') {
373
- let timestampArgs = `'${timeString}'`;
374
- const tz = timezone || qtz(qi);
375
+ else if (lit.dataType === 'timestamp') {
376
+ let timestampArgs = `'${lit.literal}'`;
377
+ const tz = lit.timezone || qtz(qi);
375
378
  if (tz && tz !== 'UTC') {
376
379
  timestampArgs += `,'${tz}'`;
377
380
  }
378
381
  return `TIMESTAMP(${timestampArgs})`;
379
382
  }
380
383
  else {
381
- throw new Error(`Unsupported Literal time format ${type}`);
384
+ throw new Error(`Unsupported Literal time format ${lit.dataType}`);
382
385
  }
383
386
  }
384
- sqlMeasureTime(from, to, units) {
387
+ sqlMeasureTimeExpr(measure) {
385
388
  const measureMap = {
386
389
  'microsecond': { use: 'microsecond', ratio: 1 },
387
390
  'millisecond': { use: 'microsecond', ratio: 1000 },
@@ -391,27 +394,29 @@ ${(0, utils_1.indent)(sql)}
391
394
  'day': { use: 'hour', ratio: 24 },
392
395
  'week': { use: 'day', ratio: 7 },
393
396
  };
394
- let lVal = from.value;
395
- let rVal = to.value;
396
- if (measureMap[units]) {
397
- const { use: measureIn, ratio } = measureMap[units];
397
+ const from = measure.kids.left;
398
+ const to = measure.kids.right;
399
+ let lVal = from.sql;
400
+ let rVal = to.sql;
401
+ if (measureMap[measure.units]) {
402
+ const { use: measureIn, ratio } = measureMap[measure.units];
398
403
  if (!timestampMeasureable(measureIn)) {
399
404
  throw new Error(`Measure in '${measureIn} not implemented`);
400
405
  }
401
- if (from.valueType !== to.valueType) {
406
+ if (from.dataType !== to.dataType) {
402
407
  throw new Error("Can't measure difference between different types");
403
408
  }
404
- if (from.valueType === 'date') {
405
- lVal = (0, malloy_types_1.mkExpr) `TIMESTAMP(${lVal})`;
406
- rVal = (0, malloy_types_1.mkExpr) `TIMESTAMP(${rVal})`;
409
+ if (from.dataType === 'date') {
410
+ lVal = `TIMESTAMP(${lVal})`;
411
+ rVal = `TIMESTAMP(${rVal})`;
407
412
  }
408
- let measured = (0, malloy_types_1.mkExpr) `TIMESTAMP_DIFF(${rVal},${lVal},${measureIn})`;
413
+ let measured = `TIMESTAMP_DIFF(${rVal},${lVal},${measureIn})`;
409
414
  if (ratio !== 1) {
410
- measured = (0, malloy_types_1.mkExpr) `FLOOR(${measured}/${ratio.toString()}.0)`;
415
+ measured = `FLOOR(${measured}/${ratio.toString()}.0)`;
411
416
  }
412
417
  return measured;
413
418
  }
414
- throw new Error(`Measure '${units} not implemented`);
419
+ throw new Error(`Measure '${measure.units} not implemented`);
415
420
  }
416
421
  sqlSampleTable(tableSQL, sample) {
417
422
  if (sample !== undefined) {
@@ -28,7 +28,7 @@ function fnConcat() {
28
28
  return [
29
29
  // TODO: in DuckDB and Postgres, nulls are treated like "",
30
30
  // but in BigQuery and Snowflake, nulls propagate and the result becomes null
31
- (0, util_1.overload)((0, util_1.minScalar)('string'), [], [{ type: 'dialect', function: 'stringLiteral', literal: '' }]),
31
+ (0, util_1.overload)((0, util_1.minScalar)('string'), [], { node: 'stringLiteral', literal: '' }),
32
32
  (0, util_1.overload)((0, util_1.minScalar)('string'), [
33
33
  (0, util_1.params)('values', (0, util_1.anyExprType)('string'), (0, util_1.anyExprType)('number'), (0, util_1.anyExprType)('date'), (0, util_1.anyExprType)('timestamp'), (0, util_1.anyExprType)('boolean')),
34
34
  ], (0, util_1.sql) `CONCAT(${(0, util_1.spread)((0, util_1.arg)('values'), 'CAST(', 'AS VARCHAR)')})`),
@@ -28,7 +28,7 @@ function fnStringAgg() {
28
28
  const value = (0, util_1.makeParam)('value', (0, util_1.maxScalar)('string'));
29
29
  const separator = (0, util_1.makeParam)('separator', (0, util_1.literal)((0, util_1.maxScalar)('string')));
30
30
  const orderBy = {
31
- type: 'aggregate_order_by',
31
+ node: 'aggregate_order_by',
32
32
  prefix: '',
33
33
  suffix: '',
34
34
  };
@@ -42,7 +42,7 @@ function fnStringAggDistinct() {
42
42
  const value = (0, util_1.makeParam)('value', (0, util_1.maxScalar)('string'));
43
43
  const separator = (0, util_1.makeParam)('separator', (0, util_1.literal)((0, util_1.maxScalar)('string')));
44
44
  const orderBy = {
45
- type: 'aggregate_order_by',
45
+ node: 'aggregate_order_by',
46
46
  prefix: '',
47
47
  suffix: '',
48
48
  };
@@ -1,7 +1,8 @@
1
- import { Expr, ExtractUnit, Sampling, TimeValue, TimestampUnit, TypecastFragment, FieldAtomicTypeDef, DialectFragment, DateUnit, TimeFieldType } from '../../model/malloy_types';
1
+ import { Expr, Sampling, FieldAtomicTypeDef, TimeDeltaExpr, TypecastExpr, RegexMatchExpr, MeasureTimeExpr, TimeLiteralNode, TimeExtractExpr } from '../../model/malloy_types';
2
2
  import { DialectFunctionOverloadDef } from '../functions';
3
- import { Dialect, DialectFieldList, OrderByClauseType, QueryInfo } from '../dialect';
4
- export declare class TrinoDialect extends Dialect {
3
+ import { DialectFieldList, OrderByClauseType, QueryInfo } from '../dialect';
4
+ import { PostgresBase } from '../pg_impl';
5
+ export declare class TrinoDialect extends PostgresBase {
5
6
  name: string;
6
7
  experimental: boolean;
7
8
  defaultNumberType: string;
@@ -30,7 +31,7 @@ export declare class TrinoDialect extends Dialect {
30
31
  supportsCountApprox: boolean;
31
32
  quoteTablePath(tablePath: string): string;
32
33
  sqlGroupSetTable(groupSetCount: number): string;
33
- dialectExpr(qi: QueryInfo, df: DialectFragment): Expr;
34
+ exprToSQL(qi: QueryInfo, df: Expr): string | undefined;
34
35
  sqlAnyValue(groupSet: number, fieldName: string): string;
35
36
  buildTypeExpression(fieldList: DialectFieldList): string;
36
37
  sqlAggregateTurtle(groupSet: number, fieldList: DialectFieldList, orderBy: string | undefined, limit: number | undefined): string;
@@ -50,14 +51,10 @@ export declare class TrinoDialect extends Dialect {
50
51
  sqlSelectAliasAsStruct(alias: string, fieldList: any): string;
51
52
  keywords: string[];
52
53
  sqlMaybeQuoteIdentifier(identifier: string): string;
53
- sqlNow(): Expr;
54
- sqlTrunc(qi: QueryInfo, sqlTime: TimeValue, units: TimestampUnit): Expr;
55
- sqlExtract(qi: QueryInfo, from: TimeValue, units: ExtractUnit): Expr;
56
- sqlAlterTime(op: '+' | '-', expr: TimeValue, n: Expr, timeframe: DateUnit): Expr;
57
- sqlCast(qi: QueryInfo, cast: TypecastFragment): Expr;
58
- sqlRegexpMatch(expr: Expr, regexp: Expr): Expr;
59
- sqlLiteralTime(qi: QueryInfo, timeString: string, type: TimeFieldType, timezone: string | undefined): string;
60
- sqlMeasureTime(from: TimeValue, to: TimeValue, units: string): Expr;
54
+ sqlAlterTimeExpr(df: TimeDeltaExpr): string;
55
+ sqlCast(qi: QueryInfo, cast: TypecastExpr): string;
56
+ sqlRegexpMatch(reCmp: RegexMatchExpr): string;
57
+ sqlMeasureTimeExpr(mf: MeasureTimeExpr): string;
61
58
  sqlSampleTable(tableSQL: string, sample: Sampling | undefined): string;
62
59
  sqlLiteralString(literal: string): string;
63
60
  sqlLiteralRegexp(literal: string): string;
@@ -69,6 +66,8 @@ export declare class TrinoDialect extends Dialect {
69
66
  sqlMakeUnnestKey(key: string, rowKey: string): string;
70
67
  sqlStringAggDistinct(distinctKey: string, valueSQL: string, separatorSQL: string): string;
71
68
  validateTypeName(sqlType: string): boolean;
69
+ sqlLiteralTime(qi: QueryInfo, lit: TimeLiteralNode): string;
70
+ sqlTimeExtractExpr(qi: QueryInfo, from: TimeExtractExpr): string;
72
71
  }
73
72
  export declare class PrestoDialect extends TrinoDialect {
74
73
  name: string;
@@ -27,6 +27,7 @@ const utils_1 = require("../../model/utils");
27
27
  const malloy_types_1 = require("../../model/malloy_types");
28
28
  const functions_1 = require("./functions");
29
29
  const dialect_1 = require("../dialect");
30
+ const pg_impl_1 = require("../pg_impl");
30
31
  // These are the units that "TIMESTAMP_ADD" "TIMESTAMP_DIFF" accept
31
32
  function timestampMeasureable(units) {
32
33
  return [
@@ -38,10 +39,6 @@ function timestampMeasureable(units) {
38
39
  'day',
39
40
  ].includes(units);
40
41
  }
41
- const pgExtractionMap = {
42
- 'day_of_week': 'dow',
43
- 'day_of_year': 'doy',
44
- };
45
42
  /**
46
43
  * Return a non UTC timezone, if one was specificed.
47
44
  */
@@ -55,7 +52,7 @@ const trinoTypeMap = {
55
52
  'string': 'VARCHAR',
56
53
  'number': 'DOUBLE',
57
54
  };
58
- class TrinoDialect extends dialect_1.Dialect {
55
+ class TrinoDialect extends pg_impl_1.PostgresBase {
59
56
  constructor() {
60
57
  super(...arguments);
61
58
  this.name = 'trino';
@@ -188,13 +185,12 @@ class TrinoDialect extends dialect_1.Dialect {
188
185
  sqlGroupSetTable(groupSetCount) {
189
186
  return `CROSS JOIN (SELECT row_number() OVER() -1 group_set FROM UNNEST(SEQUENCE(0,${groupSetCount})))`;
190
187
  }
191
- dialectExpr(qi, df) {
192
- switch (df.function) {
193
- case 'div': {
194
- return (0, malloy_types_1.mkExpr) `CAST(${df.numerator} AS DOUBLE)/${df.denominator}`;
195
- }
188
+ exprToSQL(qi, df) {
189
+ switch (df.node) {
190
+ case '/':
191
+ return `CAST(${df.kids.left.sql} AS DOUBLE)/${df.kids.right.sql}`;
196
192
  }
197
- return super.dialectExpr(qi, df);
193
+ return super.exprToSQL(qi, df);
198
194
  }
199
195
  sqlAnyValue(groupSet, fieldName) {
200
196
  return `ANY_VALUE(CASE WHEN group_set=${groupSet} THEN ${fieldName} END)`;
@@ -327,90 +323,46 @@ ${(0, utils_1.indent)(sql)}
327
323
  sqlMaybeQuoteIdentifier(identifier) {
328
324
  return '"' + identifier + '"';
329
325
  }
330
- sqlNow() {
331
- return (0, malloy_types_1.mkExpr) `LOCALTIMESTAMP`;
332
- }
333
- sqlTrunc(qi, sqlTime, units) {
334
- // adjusting for monday/sunday weeks
335
- const week = units === 'week';
336
- const truncThis = week
337
- ? (0, malloy_types_1.mkExpr) `DATE_ADD('day', 1, ${sqlTime.value})`
338
- : sqlTime.value;
339
- if (sqlTime.valueType === 'timestamp') {
340
- const tz = qtz(qi);
341
- if (tz) {
342
- const civilSource = (0, malloy_types_1.mkExpr) `AT_TIMEZONE(${truncThis},'${tz}')`;
343
- const civilTrunc = (0, malloy_types_1.mkExpr) `DATE_TRUNC('${units}', ${civilSource})`;
344
- // MTOY todo ... only need to do this if this is a date ...
345
- return (0, malloy_types_1.mkExpr) `AT_TIMEZONE(${civilTrunc},'${tz}')`;
346
- // return mkExpr`CAST((${truncTsTz}),TIMESTAMP)`;
347
- }
348
- }
349
- let result = (0, malloy_types_1.mkExpr) `DATE_TRUNC('${units}', ${truncThis})`;
350
- if (week) {
351
- result = (0, malloy_types_1.mkExpr) `DATE_ADD('day',-1, ${result})`;
352
- }
353
- return result;
354
- }
355
- sqlExtract(qi, from, units) {
356
- const pgUnits = pgExtractionMap[units] || units;
357
- let extractFrom = from.value;
358
- if (from.valueType === 'timestamp') {
359
- const tz = qtz(qi);
360
- if (tz) {
361
- extractFrom = (0, malloy_types_1.mkExpr) `at_timezone(${extractFrom},'${tz}')`;
362
- }
363
- }
364
- const extracted = (0, malloy_types_1.mkExpr) `EXTRACT(${pgUnits} FROM ${extractFrom})`;
365
- return units === 'day_of_week' ? (0, malloy_types_1.mkExpr) `mod(${extracted}+1,7)` : extracted;
366
- }
367
- sqlAlterTime(op, expr, n, timeframe) {
326
+ sqlAlterTimeExpr(df) {
327
+ let timeframe = df.units;
328
+ let n = df.kids.delta.sql;
368
329
  if (timeframe === 'quarter') {
369
330
  timeframe = 'month';
370
- n = (0, malloy_types_1.mkExpr) `${n}*3`;
331
+ n = `${n}*3`;
371
332
  }
372
333
  if (timeframe === 'week') {
373
334
  timeframe = 'day';
374
- n = (0, malloy_types_1.mkExpr) `${n}*7`;
335
+ n = `${n}*7`;
375
336
  }
376
- if (op === '-') {
377
- n = (0, malloy_types_1.mkExpr) `(${n})*-1`;
337
+ if (df.op === '-') {
338
+ n = `(${n})*-1`;
378
339
  }
379
- return (0, malloy_types_1.mkExpr) `DATE_ADD('${timeframe}', ${n}, ${expr.value})`;
340
+ return `DATE_ADD('${timeframe}', ${n}, ${df.kids.base.sql})`;
380
341
  }
381
342
  sqlCast(qi, cast) {
382
343
  const op = `${cast.srcType}=>${cast.dstType}`;
383
344
  const tz = qtz(qi);
345
+ const expr = cast.e.sql || '';
384
346
  if (op === 'timestamp=>date' && tz) {
385
- const tstz = (0, malloy_types_1.mkExpr) `CAST(${cast.expr} as TIMESTAMP)`;
386
- return (0, malloy_types_1.mkExpr) `CAST((${tstz}) AT TIME ZONE '${tz}' AS DATE)`;
347
+ const tstz = `CAST(${expr} as TIMESTAMP)`;
348
+ return `CAST((${tstz}) AT TIME ZONE '${tz}' AS DATE)`;
387
349
  }
388
350
  else if (op === 'date=>timestamp' && tz) {
389
- return (0, malloy_types_1.mkExpr) `CAST(CONCAT(CAST(CAST(${cast.expr} AS TIMESTAMP) AS VARCHAR), ' ${tz}') AS TIMESTAMP WITH TIME ZONE)`;
351
+ return `CAST(CONCAT(CAST(CAST(${expr} AS TIMESTAMP) AS VARCHAR), ' ${tz}') AS TIMESTAMP WITH TIME ZONE)`;
390
352
  }
391
353
  if (cast.srcType !== cast.dstType) {
392
354
  const dstType = typeof cast.dstType === 'string'
393
355
  ? this.malloyTypeToSQLType({ type: cast.dstType })
394
356
  : cast.dstType.raw;
395
357
  const castFunc = cast.safe ? 'TRY_CAST' : 'CAST';
396
- return (0, malloy_types_1.mkExpr) `${castFunc}(${cast.expr} AS ${dstType})`;
358
+ return `${castFunc}(${expr} AS ${dstType})`;
397
359
  }
398
- return cast.expr;
360
+ return expr;
399
361
  }
400
- sqlRegexpMatch(expr, regexp) {
401
- return (0, malloy_types_1.mkExpr) `REGEXP_LIKE(${expr}, ${regexp})`;
362
+ sqlRegexpMatch(reCmp) {
363
+ return `REGEXP_LIKE(${reCmp.kids.expr.sql}, ${reCmp.kids.regex.sql})`;
402
364
  }
403
- sqlLiteralTime(qi, timeString, type, timezone) {
404
- if (type === 'date') {
405
- return `DATE '${timeString}'`;
406
- }
407
- const tz = timezone || qtz(qi);
408
- if (tz) {
409
- return `TIMESTAMP '${timeString} ${tz}'`;
410
- }
411
- return `TIMESTAMP '${timeString}'`;
412
- }
413
- sqlMeasureTime(from, to, units) {
365
+ sqlMeasureTimeExpr(mf) {
414
366
  const measureMap = {
415
367
  'microsecond': { use: 'microsecond', ratio: 1 },
416
368
  'millisecond': { use: 'microsecond', ratio: 1000 },
@@ -420,27 +372,29 @@ ${(0, utils_1.indent)(sql)}
420
372
  'day': { use: 'hour', ratio: 24 },
421
373
  'week': { use: 'day', ratio: 7 },
422
374
  };
423
- let lVal = from.value;
424
- let rVal = to.value;
425
- if (measureMap[units]) {
426
- const { use: measureIn, ratio } = measureMap[units];
375
+ const from = mf.kids.left;
376
+ const to = mf.kids.right;
377
+ let lVal = from.sql;
378
+ let rVal = to.sql;
379
+ if (measureMap[mf.units]) {
380
+ const { use: measureIn, ratio } = measureMap[mf.units];
427
381
  if (!timestampMeasureable(measureIn)) {
428
382
  throw new Error(`Measure in '${measureIn} not implemented`);
429
383
  }
430
- if (from.valueType !== to.valueType) {
384
+ if (from.dataType !== to.dataType) {
431
385
  throw new Error("Can't measure difference between different types");
432
386
  }
433
- if (from.valueType === 'date') {
434
- lVal = (0, malloy_types_1.mkExpr) `CAST(${lVal} AS TIMESTAMP)`;
435
- rVal = (0, malloy_types_1.mkExpr) `CAST(${rVal} AS TIMESTAMP)`;
387
+ if (from.dataType === 'date') {
388
+ lVal = `CAST(${lVal} AS TIMESTAMP)`;
389
+ rVal = `CAST(${rVal} AS TIMESTAMP)`;
436
390
  }
437
- let measured = (0, malloy_types_1.mkExpr) `DATE_DIFF('${measureIn}',${lVal},${rVal})`;
391
+ let measured = `DATE_DIFF('${measureIn}',${lVal},${rVal})`;
438
392
  if (ratio !== 1) {
439
- measured = (0, malloy_types_1.mkExpr) `FLOOR(CAST(${measured} AS DOUBLE)/${ratio.toString()}.0)`;
393
+ measured = `FLOOR(CAST(${measured} AS DOUBLE)/${ratio.toString()}.0)`;
440
394
  }
441
395
  return measured;
442
396
  }
443
- throw new Error(`Measure '${units} not implemented`);
397
+ throw new Error(`Measure '${mf.units} not implemented`);
444
398
  }
445
399
  sqlSampleTable(tableSQL, sample) {
446
400
  if (sample !== undefined) {
@@ -505,6 +459,28 @@ ${(0, utils_1.indent)(sql)}
505
459
  // Angle Brackets: ARRAY<INT64>
506
460
  return sqlType.match(/^[A-Za-z\s(),<>0-9]*$/) !== null;
507
461
  }
462
+ sqlLiteralTime(qi, lit) {
463
+ if (lit.dataType === 'date') {
464
+ return `DATE '${lit.literal}'`;
465
+ }
466
+ const tz = lit.timezone || qtz(qi);
467
+ if (tz) {
468
+ return `TIMESTAMP '${lit.literal} ${tz}'`;
469
+ }
470
+ return `TIMESTAMP '${lit.literal}'`;
471
+ }
472
+ sqlTimeExtractExpr(qi, from) {
473
+ const pgUnits = pg_impl_1.timeExtractMap[from.units] || from.units;
474
+ let extractFrom = from.e.sql || '';
475
+ if (from.e.dataType === 'timestamp') {
476
+ const tz = qtz(qi);
477
+ if (tz) {
478
+ extractFrom = `at_timezone(${extractFrom},'${tz}')`;
479
+ }
480
+ }
481
+ const extracted = `EXTRACT(${pgUnits} FROM ${extractFrom})`;
482
+ return from.units === 'day_of_week' ? `mod(${extracted}+1,7)` : extracted;
483
+ }
508
484
  }
509
485
  exports.TrinoDialect = TrinoDialect;
510
486
  TrinoDialect.dtype = 'DECIMAL(38,0)';
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- export { DuckDBDialect, StandardSQLDialect, PostgresDialect, SnowflakeDialect, registerDialect, arg, qtz, overload, minScalar, anyExprType, minAggregate, maxScalar, sql, makeParam, sqlFragment, param, params, literal, spread, Dialect, FUNCTIONS, } from './dialect';
1
+ export { DuckDBDialect, StandardSQLDialect, PostgresDialect, SnowflakeDialect, registerDialect, arg, qtz, overload, minScalar, anyExprType, minAggregate, maxScalar, sql, makeParam, param, params, literal, spread, Dialect, FUNCTIONS, } from './dialect';
2
2
  export type { DialectFieldList, DialectFunctionOverloadDef, QueryInfo, } from './dialect';
3
- export type { QueryDataRow, Fragment, StructDef, StructRelationship, NamedStructDefs, MalloyQueryData, AtomicFieldType as AtomicFieldTypeInner, DateUnit, ExtractUnit, TimestampUnit, TimeFieldType, QueryData, QueryValue, FieldTypeDef, Expr, DialectFragment, TimeValue, FilterExpression, SQLBlock, FieldAtomicDef, FieldDef, PipeSegment, QueryFieldDef, IndexFieldDef, TurtleDef, SearchValueMapResult, SearchIndexResult, ModelDef, Query, QueryResult, QueryRunStats, NamedQuery, NamedModelObject, ExpressionType, FunctionDef, FunctionOverloadDef, FunctionParameterDef, ExpressionValueType, TypeDesc, FieldValueType, ExpressionTypeDesc, FunctionParamTypeDesc, DocumentLocation, DocumentRange, DocumentPosition, Sampling, TypecastFragment, Annotation, FieldAtomicTypeDef, SQLBlockStructDef, } from './model';
4
- export { Segment, isSamplingEnable, isSamplingPercent, isSamplingRows, mkExpr, expressionIsCalculation, indent, } from './model';
3
+ export type { QueryDataRow, StructDef, StructRelationship, NamedStructDefs, MalloyQueryData, AtomicFieldType as AtomicFieldTypeInner, DateUnit, ExtractUnit, TimestampUnit, TimeFieldType, QueryData, QueryValue, FieldTypeDef, Expr, FilterCondition, SQLBlock, FieldAtomicDef, FieldDef, PipeSegment, QueryFieldDef, IndexFieldDef, TurtleDef, SearchValueMapResult, SearchIndexResult, ModelDef, Query, QueryResult, QueryRunStats, NamedQuery, NamedModelObject, ExpressionType, FunctionDef, FunctionOverloadDef, FunctionParameterDef, ExpressionValueType, TypeDesc, FieldValueType, ExpressionTypeDesc, FunctionParamTypeDesc, DocumentLocation, DocumentRange, DocumentPosition, Sampling, Annotation, FieldAtomicTypeDef, SQLBlockStructDef, } from './model';
4
+ export { Segment, isSamplingEnable, isSamplingPercent, isSamplingRows, expressionIsCalculation, indent, composeSQLExpr, } from './model';
5
5
  export { MalloyTranslator, } from './lang';
6
6
  export type { LogMessage, TranslateResponse } from './lang';
7
7
  export { Model, Malloy, Runtime, AtomicFieldType, ConnectionRuntime, SingleConnectionRuntime, EmptyURLReader, InMemoryURLReader, FixedConnectionMap, MalloyError, JoinRelationship, SourceRelationship, DateTimeframe, TimestampTimeframe, PreparedResult, Result, QueryMaterializer, CSVWriter, JSONWriter, Parse, DataWriter, Explore, } from './malloy';
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DataWriter = exports.Parse = exports.JSONWriter = exports.CSVWriter = exports.QueryMaterializer = exports.Result = exports.PreparedResult = exports.TimestampTimeframe = exports.DateTimeframe = exports.SourceRelationship = exports.JoinRelationship = exports.MalloyError = exports.FixedConnectionMap = exports.InMemoryURLReader = exports.EmptyURLReader = exports.SingleConnectionRuntime = exports.ConnectionRuntime = exports.AtomicFieldType = exports.Runtime = exports.Malloy = exports.Model = exports.MalloyTranslator = exports.indent = exports.expressionIsCalculation = exports.mkExpr = exports.isSamplingRows = exports.isSamplingPercent = exports.isSamplingEnable = exports.Segment = exports.FUNCTIONS = exports.Dialect = exports.spread = exports.literal = exports.params = exports.param = exports.sqlFragment = exports.makeParam = exports.sql = exports.maxScalar = exports.minAggregate = exports.anyExprType = exports.minScalar = exports.overload = exports.qtz = exports.arg = exports.registerDialect = exports.SnowflakeDialect = exports.PostgresDialect = exports.StandardSQLDialect = exports.DuckDBDialect = void 0;
4
- exports.Tag = exports.toAsyncGenerator = exports.Explore = void 0;
3
+ exports.Explore = exports.DataWriter = exports.Parse = exports.JSONWriter = exports.CSVWriter = exports.QueryMaterializer = exports.Result = exports.PreparedResult = exports.TimestampTimeframe = exports.DateTimeframe = exports.SourceRelationship = exports.JoinRelationship = exports.MalloyError = exports.FixedConnectionMap = exports.InMemoryURLReader = exports.EmptyURLReader = exports.SingleConnectionRuntime = exports.ConnectionRuntime = exports.AtomicFieldType = exports.Runtime = exports.Malloy = exports.Model = exports.MalloyTranslator = exports.composeSQLExpr = exports.indent = exports.expressionIsCalculation = exports.isSamplingRows = exports.isSamplingPercent = exports.isSamplingEnable = exports.Segment = exports.FUNCTIONS = exports.Dialect = exports.spread = exports.literal = exports.params = exports.param = exports.makeParam = exports.sql = exports.maxScalar = exports.minAggregate = exports.anyExprType = exports.minScalar = exports.overload = exports.qtz = exports.arg = exports.registerDialect = exports.SnowflakeDialect = exports.PostgresDialect = exports.StandardSQLDialect = exports.DuckDBDialect = void 0;
4
+ exports.Tag = exports.toAsyncGenerator = void 0;
5
5
  /*
6
6
  * Copyright 2023 Google LLC
7
7
  *
@@ -39,7 +39,6 @@ Object.defineProperty(exports, "minAggregate", { enumerable: true, get: function
39
39
  Object.defineProperty(exports, "maxScalar", { enumerable: true, get: function () { return dialect_1.maxScalar; } });
40
40
  Object.defineProperty(exports, "sql", { enumerable: true, get: function () { return dialect_1.sql; } });
41
41
  Object.defineProperty(exports, "makeParam", { enumerable: true, get: function () { return dialect_1.makeParam; } });
42
- Object.defineProperty(exports, "sqlFragment", { enumerable: true, get: function () { return dialect_1.sqlFragment; } });
43
42
  Object.defineProperty(exports, "param", { enumerable: true, get: function () { return dialect_1.param; } });
44
43
  Object.defineProperty(exports, "params", { enumerable: true, get: function () { return dialect_1.params; } });
45
44
  Object.defineProperty(exports, "literal", { enumerable: true, get: function () { return dialect_1.literal; } });
@@ -52,9 +51,9 @@ Object.defineProperty(exports, "Segment", { enumerable: true, get: function () {
52
51
  Object.defineProperty(exports, "isSamplingEnable", { enumerable: true, get: function () { return model_1.isSamplingEnable; } });
53
52
  Object.defineProperty(exports, "isSamplingPercent", { enumerable: true, get: function () { return model_1.isSamplingPercent; } });
54
53
  Object.defineProperty(exports, "isSamplingRows", { enumerable: true, get: function () { return model_1.isSamplingRows; } });
55
- Object.defineProperty(exports, "mkExpr", { enumerable: true, get: function () { return model_1.mkExpr; } });
56
54
  Object.defineProperty(exports, "expressionIsCalculation", { enumerable: true, get: function () { return model_1.expressionIsCalculation; } });
57
55
  Object.defineProperty(exports, "indent", { enumerable: true, get: function () { return model_1.indent; } });
56
+ Object.defineProperty(exports, "composeSQLExpr", { enumerable: true, get: function () { return model_1.composeSQLExpr; } });
58
57
  var lang_1 = require("./lang");
59
58
  // Needed for tests only
60
59
  Object.defineProperty(exports, "MalloyTranslator", { enumerable: true, get: function () { return lang_1.MalloyTranslator; } });
@@ -5,6 +5,6 @@ import { ExprValue } from './types/expr-value';
5
5
  * generated SQL will have a reference to an impossible variable name
6
6
  * with the reason embedded in it.
7
7
  * @param reason very short phrase, only read by implementers
8
- * @return Fragment[] which a debugging humnan will regognize
8
+ * @return Expr which a debugging humnan will regognize
9
9
  */
10
10
  export declare function errorFor(reason: string): ExprValue;
@@ -29,13 +29,13 @@ exports.errorFor = void 0;
29
29
  * generated SQL will have a reference to an impossible variable name
30
30
  * with the reason embedded in it.
31
31
  * @param reason very short phrase, only read by implementers
32
- * @return Fragment[] which a debugging humnan will regognize
32
+ * @return Expr which a debugging humnan will regognize
33
33
  */
34
34
  function errorFor(reason) {
35
35
  return {
36
36
  dataType: 'error',
37
37
  expressionType: 'scalar',
38
- value: [`_ERROR_${reason.replace(/ /g, '_')}`],
38
+ value: { node: 'error', message: reason },
39
39
  evalSpace: 'constant',
40
40
  };
41
41
  }
@@ -23,13 +23,12 @@
23
23
  */
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
25
  exports.Apply = void 0;
26
- const comparison_1 = require("../types/comparison");
27
26
  const expr_compare_1 = require("./expr-compare");
28
27
  const granular_result_1 = require("../types/granular-result");
29
28
  const expr_granular_time_1 = require("./expr-granular-time");
30
29
  class Apply extends expr_compare_1.ExprCompare {
31
30
  constructor(left, right) {
32
- super(left, comparison_1.Comparison.EqualTo, right);
31
+ super(left, '=', right);
33
32
  this.left = left;
34
33
  this.right = right;
35
34
  this.elementType = 'apply';
@@ -1,7 +1,8 @@
1
+ import { BinaryMalloyOperator } from '../types/binary_operators';
1
2
  import { ExprValue } from '../types/expr-value';
2
3
  import { ExpressionDef } from '../types/expression-def';
3
4
  import { FieldSpace } from '../types/field-space';
4
- export declare abstract class BinaryBoolean<opType extends string> extends ExpressionDef {
5
+ export declare abstract class BinaryBoolean<opType extends BinaryMalloyOperator> extends ExpressionDef {
5
6
  readonly left: ExpressionDef;
6
7
  readonly op: opType;
7
8
  readonly right: ExpressionDef;
@@ -26,11 +26,11 @@ exports.BinaryBoolean = void 0;
26
26
  const malloy_types_1 = require("../../../model/malloy_types");
27
27
  const ast_utils_1 = require("../ast-utils");
28
28
  const fragtype_utils_1 = require("../fragtype-utils");
29
+ const binary_operators_1 = require("../types/binary_operators");
29
30
  const expression_def_1 = require("../types/expression-def");
30
- const utils_1 = require("./utils");
31
31
  class BinaryBoolean extends expression_def_1.ExpressionDef {
32
32
  constructor(left, op, right) {
33
- super({ left: left, right: right });
33
+ super({ left, right });
34
34
  this.left = left;
35
35
  this.op = op;
36
36
  this.right = right;
@@ -45,8 +45,11 @@ class BinaryBoolean extends expression_def_1.ExpressionDef {
45
45
  return {
46
46
  dataType: 'boolean',
47
47
  expressionType: (0, malloy_types_1.maxExpressionType)(left.expressionType, right.expressionType),
48
+ value: {
49
+ node: (0, binary_operators_1.getExprNode)(this.op),
50
+ kids: { left: left.value, right: right.value },
51
+ },
48
52
  evalSpace,
49
- value: (0, utils_1.compose)(left.value, this.op, right.value),
50
53
  };
51
54
  }
52
55
  return (0, ast_utils_1.errorFor)('logial required boolean');
@@ -1,7 +1,8 @@
1
+ import { ArithmeticMalloyOperator } from '../types/binary_operators';
1
2
  import { ExprValue } from '../types/expr-value';
2
3
  import { ExpressionDef } from '../types/expression-def';
3
4
  import { FieldSpace } from '../types/field-space';
4
- export declare abstract class BinaryNumeric<opType extends string> extends ExpressionDef {
5
+ export declare abstract class BinaryNumeric<opType extends ArithmeticMalloyOperator> extends ExpressionDef {
5
6
  readonly left: ExpressionDef;
6
7
  readonly op: opType;
7
8
  readonly right: ExpressionDef;
@@ -32,7 +32,7 @@ class Boolean extends expression_def_1.ExpressionDef {
32
32
  this.elementType = 'boolean literal';
33
33
  }
34
34
  getExpression() {
35
- return { ...fragtype_utils_1.FT.boolT, value: [this.value] };
35
+ return { ...fragtype_utils_1.FT.boolT, value: { node: this.value } };
36
36
  }
37
37
  }
38
38
  exports.Boolean = Boolean;