@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.
- package/dist/dialect/dialect.d.ts +23 -13
- package/dist/dialect/dialect.js +33 -27
- package/dist/dialect/duckdb/duckdb.d.ts +7 -11
- package/dist/dialect/duckdb/duckdb.js +34 -100
- package/dist/dialect/duckdb/functions/greatest_and_least.js +5 -12
- package/dist/dialect/functions/concat.js +1 -1
- package/dist/dialect/functions/greatest_and_least.js +1 -1
- package/dist/dialect/functions/simple_numeric_functions.js +1 -1
- package/dist/dialect/functions/sql.js +5 -15
- package/dist/dialect/functions/string_agg.js +2 -2
- package/dist/dialect/functions/trim_functions.js +2 -2
- package/dist/dialect/functions/util.d.ts +6 -9
- package/dist/dialect/functions/util.js +29 -38
- package/dist/dialect/index.d.ts +1 -1
- package/dist/dialect/index.js +1 -2
- package/dist/dialect/pg_impl.d.ts +15 -0
- package/dist/dialect/pg_impl.js +91 -0
- package/dist/dialect/postgres/functions/greatest_and_least.js +1 -3
- package/dist/dialect/postgres/functions/string_agg.js +2 -2
- package/dist/dialect/postgres/postgres.d.ts +7 -11
- package/dist/dialect/postgres/postgres.js +29 -92
- package/dist/dialect/snowflake/functions/string_agg.js +2 -2
- package/dist/dialect/snowflake/snowflake.d.ts +9 -9
- package/dist/dialect/snowflake/snowflake.js +41 -48
- package/dist/dialect/standardsql/functions/string_agg.js +4 -4
- package/dist/dialect/standardsql/standardsql.d.ts +9 -9
- package/dist/dialect/standardsql/standardsql.js +56 -51
- package/dist/dialect/trino/functions/concat.js +1 -1
- package/dist/dialect/trino/functions/string_agg.js +2 -2
- package/dist/dialect/trino/trino.d.ts +11 -12
- package/dist/dialect/trino/trino.js +59 -83
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -4
- package/dist/lang/ast/ast-utils.d.ts +1 -1
- package/dist/lang/ast/ast-utils.js +2 -2
- package/dist/lang/ast/expressions/apply.js +1 -2
- package/dist/lang/ast/expressions/binary-boolean.d.ts +2 -1
- package/dist/lang/ast/expressions/binary-boolean.js +6 -3
- package/dist/lang/ast/expressions/binary-numeric.d.ts +2 -1
- package/dist/lang/ast/expressions/boolean.js +1 -1
- package/dist/lang/ast/expressions/constant-expression.d.ts +3 -3
- package/dist/lang/ast/expressions/constant-expression.js +0 -23
- package/dist/lang/ast/expressions/expr-aggregate-function.js +24 -34
- package/dist/lang/ast/expressions/expr-alternation-tree.d.ts +6 -3
- package/dist/lang/ast/expressions/expr-alternation-tree.js +10 -5
- package/dist/lang/ast/expressions/expr-cast.js +1 -2
- package/dist/lang/ast/expressions/expr-coalesce.js +4 -1
- package/dist/lang/ast/expressions/expr-compare.d.ts +3 -3
- package/dist/lang/ast/expressions/expr-count-distinct.js +1 -1
- package/dist/lang/ast/expressions/expr-count.js +3 -3
- package/dist/lang/ast/expressions/expr-func.js +15 -18
- package/dist/lang/ast/expressions/expr-granular-time.js +8 -10
- package/dist/lang/ast/expressions/expr-id-reference.js +2 -2
- package/dist/lang/ast/expressions/expr-minus.js +5 -4
- package/dist/lang/ast/expressions/expr-not.js +1 -1
- package/dist/lang/ast/expressions/expr-now.js +1 -6
- package/dist/lang/ast/expressions/expr-null.js +1 -1
- package/dist/lang/ast/expressions/expr-number.js +1 -1
- package/dist/lang/ast/expressions/expr-parens.js +1 -1
- package/dist/lang/ast/expressions/expr-props.js +4 -7
- package/dist/lang/ast/expressions/expr-regex.js +1 -3
- package/dist/lang/ast/expressions/expr-string.js +1 -7
- package/dist/lang/ast/expressions/expr-time-extract.js +12 -16
- package/dist/lang/ast/expressions/expr-time.d.ts +2 -2
- package/dist/lang/ast/expressions/expr-time.js +4 -6
- package/dist/lang/ast/expressions/expr-ungroup.js +2 -2
- package/dist/lang/ast/expressions/for-range.d.ts +2 -1
- package/dist/lang/ast/expressions/function-ordering.js +5 -5
- package/dist/lang/ast/expressions/partial-compare.d.ts +3 -3
- package/dist/lang/ast/expressions/pick-when.js +24 -8
- package/dist/lang/ast/expressions/range.d.ts +2 -1
- package/dist/lang/ast/expressions/range.js +4 -2
- package/dist/lang/ast/expressions/time-literal.d.ts +4 -3
- package/dist/lang/ast/expressions/time-literal.js +5 -10
- package/dist/lang/ast/expressions/top-by.js +1 -2
- package/dist/lang/ast/expressions/utils.d.ts +3 -12
- package/dist/lang/ast/expressions/utils.js +8 -56
- package/dist/lang/ast/field-space/reference-field.js +1 -1
- package/dist/lang/ast/index.d.ts +1 -1
- package/dist/lang/ast/index.js +1 -1
- package/dist/lang/ast/query-builders/index-builder.d.ts +2 -2
- package/dist/lang/ast/query-builders/reduce-builder.d.ts +2 -2
- package/dist/lang/ast/query-items/field-declaration.js +1 -5
- package/dist/lang/ast/query-properties/filters.d.ts +3 -3
- package/dist/lang/ast/query-properties/filters.js +6 -5
- package/dist/lang/ast/query-properties/top.js +1 -2
- package/dist/lang/ast/source-elements/refined-source.js +1 -1
- package/dist/lang/ast/source-properties/joins.js +11 -10
- package/dist/lang/ast/time-utils.d.ts +5 -7
- package/dist/lang/ast/time-utils.js +17 -57
- package/dist/lang/ast/types/binary_operators.d.ts +9 -0
- package/dist/lang/ast/types/binary_operators.js +28 -0
- package/dist/lang/ast/types/expr-result.d.ts +3 -3
- package/dist/lang/ast/types/expression-def.d.ts +4 -3
- package/dist/lang/ast/types/expression-def.js +43 -50
- package/dist/lang/lib/Malloy/MalloyParser.d.ts +0 -11
- package/dist/lang/lib/Malloy/MalloyParser.js +803 -858
- package/dist/lang/lib/Malloy/MalloyParserListener.d.ts +0 -13
- package/dist/lang/lib/Malloy/MalloyParserVisitor.d.ts +0 -8
- package/dist/lang/malloy-to-ast.d.ts +0 -1
- package/dist/lang/malloy-to-ast.js +0 -4
- package/dist/lang/test/expressions.spec.js +42 -86
- package/dist/lang/test/field-symbols.spec.js +8 -6
- package/dist/lang/test/literals.spec.js +6 -6
- package/dist/lang/test/model_serialization.spec.js +5 -5
- package/dist/lang/test/test-translator.js +9 -7
- package/dist/malloy.d.ts +3 -3
- package/dist/malloy.js +1 -1
- package/dist/model/index.d.ts +1 -1
- package/dist/model/index.js +2 -1
- package/dist/model/malloy_query.d.ts +24 -19
- package/dist/model/malloy_query.js +272 -244
- package/dist/model/malloy_types.d.ts +224 -205
- package/dist/model/malloy_types.js +19 -98
- package/dist/model/utils.d.ts +10 -3
- package/dist/model/utils.js +84 -219
- package/package.json +1 -1
- package/dist/lang/ast/types/comparison.d.ts +0 -11
- package/dist/lang/ast/types/comparison.js +0 -41
- package/dist/lang/ast/types/equality.d.ts +0 -7
- 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
|
-
|
|
304
|
-
return
|
|
303
|
+
sqlNowExpr() {
|
|
304
|
+
return 'CURRENT_TIMESTAMP()';
|
|
305
305
|
}
|
|
306
|
-
|
|
306
|
+
sqlTruncExpr(qi, trunc) {
|
|
307
307
|
const tz = qtz(qi);
|
|
308
308
|
const tzAdd = tz ? `, "${tz}"` : '';
|
|
309
|
-
if (
|
|
310
|
-
if (dateMeasureable(units)) {
|
|
311
|
-
return
|
|
309
|
+
if (trunc.e.dataType === 'date') {
|
|
310
|
+
if (dateMeasureable(trunc.units)) {
|
|
311
|
+
return `DATE_TRUNC(${trunc.e.sql},${trunc.units})`;
|
|
312
312
|
}
|
|
313
|
-
return
|
|
313
|
+
return `TIMESTAMP(${trunc.e.sql}${tzAdd})`;
|
|
314
314
|
}
|
|
315
|
-
return
|
|
315
|
+
return `TIMESTAMP_TRUNC(${trunc.e.sql},${trunc.units}${tzAdd})`;
|
|
316
316
|
}
|
|
317
|
-
|
|
318
|
-
const extractTo = extractMap[units] || units;
|
|
319
|
-
const tz =
|
|
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
|
|
321
|
+
return `EXTRACT(${extractTo} FROM ${te.e.sql}${tzAdd})`;
|
|
322
322
|
}
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
let
|
|
326
|
-
|
|
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
|
-
|
|
329
|
-
|
|
330
|
-
|
|
329
|
+
if (dataType !== 'timestamp') {
|
|
330
|
+
sql = `TIMESTAMP(${sql})`;
|
|
331
|
+
dataType = 'timestamp';
|
|
331
332
|
}
|
|
332
333
|
}
|
|
333
|
-
else if (
|
|
334
|
-
|
|
335
|
-
|
|
334
|
+
else if (dataType === 'timestamp') {
|
|
335
|
+
sql = `DATETIME(${sql})`;
|
|
336
|
+
dataType = 'datetime';
|
|
336
337
|
}
|
|
337
|
-
const
|
|
338
|
-
const
|
|
339
|
-
|
|
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
|
|
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
|
|
354
|
+
return `DATE(${src},'${tz}')`;
|
|
352
355
|
}
|
|
353
356
|
if (op === 'date::timestamp' && tz) {
|
|
354
|
-
return
|
|
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
|
|
364
|
+
return `${castFunc}(${src} AS ${dstType})`;
|
|
362
365
|
}
|
|
363
|
-
return
|
|
366
|
+
return src;
|
|
364
367
|
}
|
|
365
|
-
sqlRegexpMatch(
|
|
366
|
-
return
|
|
368
|
+
sqlRegexpMatch(match) {
|
|
369
|
+
return `REGEXP_CONTAINS(${match.kids.expr.sql},${match.kids.regex.sql})`;
|
|
367
370
|
}
|
|
368
|
-
sqlLiteralTime(qi,
|
|
369
|
-
if (
|
|
370
|
-
return `DATE('${
|
|
371
|
+
sqlLiteralTime(qi, lit) {
|
|
372
|
+
if (lit.dataType === 'date') {
|
|
373
|
+
return `DATE('${lit.literal}')`;
|
|
371
374
|
}
|
|
372
|
-
else if (
|
|
373
|
-
let timestampArgs = `'${
|
|
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 ${
|
|
384
|
+
throw new Error(`Unsupported Literal time format ${lit.dataType}`);
|
|
382
385
|
}
|
|
383
386
|
}
|
|
384
|
-
|
|
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
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
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.
|
|
406
|
+
if (from.dataType !== to.dataType) {
|
|
402
407
|
throw new Error("Can't measure difference between different types");
|
|
403
408
|
}
|
|
404
|
-
if (from.
|
|
405
|
-
lVal =
|
|
406
|
-
rVal =
|
|
409
|
+
if (from.dataType === 'date') {
|
|
410
|
+
lVal = `TIMESTAMP(${lVal})`;
|
|
411
|
+
rVal = `TIMESTAMP(${rVal})`;
|
|
407
412
|
}
|
|
408
|
-
let measured =
|
|
413
|
+
let measured = `TIMESTAMP_DIFF(${rVal},${lVal},${measureIn})`;
|
|
409
414
|
if (ratio !== 1) {
|
|
410
|
-
measured =
|
|
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'), [],
|
|
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
|
-
|
|
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
|
-
|
|
45
|
+
node: 'aggregate_order_by',
|
|
46
46
|
prefix: '',
|
|
47
47
|
suffix: '',
|
|
48
48
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { Expr,
|
|
1
|
+
import { Expr, Sampling, FieldAtomicTypeDef, TimeDeltaExpr, TypecastExpr, RegexMatchExpr, MeasureTimeExpr, TimeLiteralNode, TimeExtractExpr } from '../../model/malloy_types';
|
|
2
2
|
import { DialectFunctionOverloadDef } from '../functions';
|
|
3
|
-
import {
|
|
4
|
-
|
|
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
|
-
|
|
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
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
|
|
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
|
-
|
|
192
|
-
switch (df.
|
|
193
|
-
case '
|
|
194
|
-
return
|
|
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.
|
|
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
|
-
|
|
331
|
-
|
|
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 =
|
|
331
|
+
n = `${n}*3`;
|
|
371
332
|
}
|
|
372
333
|
if (timeframe === 'week') {
|
|
373
334
|
timeframe = 'day';
|
|
374
|
-
n =
|
|
335
|
+
n = `${n}*7`;
|
|
375
336
|
}
|
|
376
|
-
if (op === '-') {
|
|
377
|
-
n =
|
|
337
|
+
if (df.op === '-') {
|
|
338
|
+
n = `(${n})*-1`;
|
|
378
339
|
}
|
|
379
|
-
return
|
|
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 =
|
|
386
|
-
return
|
|
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
|
|
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
|
|
358
|
+
return `${castFunc}(${expr} AS ${dstType})`;
|
|
397
359
|
}
|
|
398
|
-
return
|
|
360
|
+
return expr;
|
|
399
361
|
}
|
|
400
|
-
sqlRegexpMatch(
|
|
401
|
-
return
|
|
362
|
+
sqlRegexpMatch(reCmp) {
|
|
363
|
+
return `REGEXP_LIKE(${reCmp.kids.expr.sql}, ${reCmp.kids.regex.sql})`;
|
|
402
364
|
}
|
|
403
|
-
|
|
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
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
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.
|
|
384
|
+
if (from.dataType !== to.dataType) {
|
|
431
385
|
throw new Error("Can't measure difference between different types");
|
|
432
386
|
}
|
|
433
|
-
if (from.
|
|
434
|
-
lVal =
|
|
435
|
-
rVal =
|
|
387
|
+
if (from.dataType === 'date') {
|
|
388
|
+
lVal = `CAST(${lVal} AS TIMESTAMP)`;
|
|
389
|
+
rVal = `CAST(${rVal} AS TIMESTAMP)`;
|
|
436
390
|
}
|
|
437
|
-
let measured =
|
|
391
|
+
let measured = `DATE_DIFF('${measureIn}',${lVal},${rVal})`;
|
|
438
392
|
if (ratio !== 1) {
|
|
439
|
-
measured =
|
|
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,
|
|
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,
|
|
4
|
-
export { Segment, isSamplingEnable, isSamplingPercent, isSamplingRows,
|
|
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.
|
|
4
|
-
exports.Tag = exports.toAsyncGenerator =
|
|
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
|
|
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
|
|
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:
|
|
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,
|
|
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
|
|
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
|
|
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
|
|
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:
|
|
35
|
+
return { ...fragtype_utils_1.FT.boolT, value: { node: this.value } };
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
exports.Boolean = Boolean;
|