@malloydata/malloy 0.0.195-dev241003204905 → 0.0.195-dev241007154000
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/connection/base_connection.d.ts +21 -7
- package/dist/connection/base_connection.js +62 -0
- package/dist/connection/types.d.ts +5 -5
- package/dist/dialect/dialect.d.ts +5 -3
- package/dist/dialect/dialect.js +15 -0
- package/dist/dialect/duckdb/duckdb.d.ts +3 -3
- package/dist/dialect/duckdb/duckdb.js +8 -3
- package/dist/dialect/postgres/postgres.d.ts +3 -3
- package/dist/dialect/postgres/postgres.js +5 -2
- package/dist/dialect/snowflake/snowflake.d.ts +3 -3
- package/dist/dialect/snowflake/snowflake.js +4 -1
- package/dist/dialect/standardsql/standardsql.d.ts +3 -3
- package/dist/dialect/standardsql/standardsql.js +5 -2
- package/dist/dialect/trino/trino.d.ts +3 -3
- package/dist/dialect/trino/trino.js +35 -3
- package/dist/index.d.ts +4 -4
- package/dist/index.js +6 -2
- package/dist/lang/ast/error-factory.d.ts +4 -3
- package/dist/lang/ast/error-factory.js +27 -17
- package/dist/lang/ast/expressions/constant-expression.d.ts +1 -0
- package/dist/lang/ast/expressions/constant-expression.js +3 -0
- package/dist/lang/ast/expressions/expr-aggregate-function.d.ts +3 -7
- package/dist/lang/ast/expressions/expr-aggregate-function.js +50 -54
- package/dist/lang/ast/expressions/expr-cast.js +2 -4
- package/dist/lang/ast/expressions/expr-func.js +1 -1
- package/dist/lang/ast/expressions/expr-granular-time.js +1 -1
- package/dist/lang/ast/expressions/expr-record-literal.d.ts +16 -0
- package/dist/lang/ast/expressions/expr-record-literal.js +57 -0
- package/dist/lang/ast/expressions/expr-time-extract.js +3 -3
- package/dist/lang/ast/expressions/expr-time.d.ts +3 -3
- package/dist/lang/ast/expressions/expr-time.js +1 -1
- package/dist/lang/ast/expressions/time-literal.d.ts +6 -6
- package/dist/lang/ast/expressions/time-literal.js +1 -1
- package/dist/lang/ast/field-space/column-space-field.d.ts +6 -5
- package/dist/lang/ast/field-space/column-space-field.js +7 -4
- package/dist/lang/ast/field-space/dynamic-space.d.ts +8 -6
- package/dist/lang/ast/field-space/dynamic-space.js +35 -11
- package/dist/lang/ast/field-space/index-field-space.js +6 -3
- package/dist/lang/ast/field-space/ir-view-field.d.ts +1 -0
- package/dist/lang/ast/field-space/ir-view-field.js +3 -1
- package/dist/lang/ast/field-space/join-space-field.d.ts +2 -2
- package/dist/lang/ast/field-space/join-space-field.js +2 -2
- package/dist/lang/ast/field-space/parameter-space.d.ts +1 -0
- package/dist/lang/ast/field-space/parameter-space.js +4 -1
- package/dist/lang/ast/field-space/query-input-space.d.ts +4 -4
- package/dist/lang/ast/field-space/query-input-space.js +3 -5
- package/dist/lang/ast/field-space/query-spaces.d.ts +4 -4
- package/dist/lang/ast/field-space/query-spaces.js +1 -1
- package/dist/lang/ast/field-space/reference-field.js +10 -8
- package/dist/lang/ast/field-space/refined-space.d.ts +2 -2
- package/dist/lang/ast/field-space/static-space.d.ts +14 -5
- package/dist/lang/ast/field-space/static-space.js +45 -20
- package/dist/lang/ast/field-space/struct-space-field-base.d.ts +6 -5
- package/dist/lang/ast/field-space/struct-space-field-base.js +12 -4
- package/dist/lang/ast/index.d.ts +2 -1
- package/dist/lang/ast/index.js +2 -1
- package/dist/lang/ast/query-builders/index-builder.d.ts +2 -2
- package/dist/lang/ast/query-builders/project-builder.d.ts +2 -2
- package/dist/lang/ast/query-builders/reduce-builder.d.ts +2 -2
- package/dist/lang/ast/query-elements/query-arrow.js +2 -2
- package/dist/lang/ast/query-elements/query-head-struct.d.ts +2 -2
- package/dist/lang/ast/query-elements/query-head-struct.js +2 -2
- package/dist/lang/ast/query-elements/query-raw.js +2 -2
- package/dist/lang/ast/query-elements/query-reference.js +1 -1
- package/dist/lang/ast/query-items/field-declaration.d.ts +8 -6
- package/dist/lang/ast/query-items/field-declaration.js +66 -24
- package/dist/lang/ast/query-properties/qop-desc.d.ts +2 -2
- package/dist/lang/ast/query-properties/qop-desc.js +1 -1
- package/dist/lang/ast/source-elements/named-source.d.ts +4 -4
- package/dist/lang/ast/source-elements/named-source.js +16 -8
- package/dist/lang/ast/source-elements/query-source.d.ts +3 -3
- package/dist/lang/ast/source-elements/query-source.js +5 -2
- package/dist/lang/ast/source-elements/refined-source.d.ts +3 -3
- package/dist/lang/ast/source-elements/refined-source.js +4 -4
- package/dist/lang/ast/source-elements/source.d.ts +2 -2
- package/dist/lang/ast/source-elements/source.js +2 -2
- package/dist/lang/ast/source-elements/sql-source.d.ts +4 -4
- package/dist/lang/ast/source-elements/sql-source.js +6 -6
- package/dist/lang/ast/source-elements/table-source.d.ts +2 -2
- package/dist/lang/ast/source-elements/table-source.js +1 -1
- package/dist/lang/ast/source-properties/{joins.d.ts → join.d.ts} +11 -14
- package/dist/lang/ast/source-properties/{joins.js → join.js} +35 -52
- package/dist/lang/ast/source-query-elements/sq-reference.js +6 -5
- package/dist/lang/ast/sql-elements/sql-string.d.ts +2 -2
- package/dist/lang/ast/statements/define-source.js +1 -1
- package/dist/lang/ast/struct-utils.d.ts +3 -3
- package/dist/lang/ast/struct-utils.js +12 -3
- package/dist/lang/ast/time-utils.d.ts +3 -3
- package/dist/lang/ast/types/document-compile-result.d.ts +2 -2
- package/dist/lang/ast/types/expression-def.js +4 -4
- package/dist/lang/ast/types/field-space.d.ts +8 -3
- package/dist/lang/ast/types/lookup-result.d.ts +8 -5
- package/dist/lang/ast/types/malloy-element.d.ts +3 -3
- package/dist/lang/ast/types/malloy-element.js +10 -21
- package/dist/lang/ast/types/op-desc.d.ts +2 -2
- package/dist/lang/ast/types/pipeline-comp.d.ts +2 -2
- package/dist/lang/ast/types/query-comp.d.ts +3 -3
- package/dist/lang/ast/types/query-extend-property.d.ts +1 -2
- package/dist/lang/ast/types/query-extend-property.js +4 -2
- package/dist/lang/ast/types/source-property.d.ts +2 -2
- package/dist/lang/ast/types/source-property.js +2 -2
- package/dist/lang/ast/types/space-field.d.ts +10 -3
- package/dist/lang/ast/types/space-field.js +11 -2
- package/dist/lang/ast/types/time-result.d.ts +2 -2
- package/dist/lang/ast/view-elements/qop-desc-view.d.ts +3 -3
- package/dist/lang/ast/view-elements/qop-desc-view.js +1 -1
- package/dist/lang/ast/view-elements/reference-view.d.ts +4 -4
- package/dist/lang/ast/view-elements/reference-view.js +2 -6
- package/dist/lang/ast/view-elements/view-refine.d.ts +2 -2
- package/dist/lang/index.d.ts +1 -1
- package/dist/lang/lib/Malloy/MalloyParser.d.ts +54 -21
- package/dist/lang/lib/Malloy/MalloyParser.js +1647 -1457
- package/dist/lang/lib/Malloy/MalloyParserListener.d.ts +57 -9
- package/dist/lang/lib/Malloy/MalloyParserVisitor.d.ts +35 -5
- package/dist/lang/malloy-to-ast.d.ts +4 -4
- package/dist/lang/malloy-to-ast.js +32 -4
- package/dist/lang/parse-log.d.ts +5 -9
- package/dist/lang/parse-malloy.d.ts +10 -10
- package/dist/lang/parse-malloy.js +2 -1
- package/dist/lang/test/annotation.spec.js +7 -1
- package/dist/lang/test/field-symbols.spec.js +21 -25
- package/dist/lang/test/imports.spec.js +12 -10
- package/dist/lang/test/lenses.spec.js +2 -2
- package/dist/lang/test/model_serialization.spec.d.ts +4 -4
- package/dist/lang/test/model_serialization.spec.js +19 -31
- package/dist/lang/test/parse.spec.js +3 -4
- package/dist/lang/test/query.spec.js +3 -2
- package/dist/lang/test/source.spec.js +7 -0
- package/dist/lang/test/sql-block.spec.js +8 -19
- package/dist/lang/test/test-translator.d.ts +4 -4
- package/dist/lang/test/test-translator.js +53 -61
- package/dist/lang/translate-response.d.ts +3 -3
- package/dist/malloy.d.ts +31 -149
- package/dist/malloy.js +109 -267
- package/dist/model/malloy_query.d.ts +25 -23
- package/dist/model/malloy_query.js +262 -323
- package/dist/model/malloy_types.d.ts +145 -155
- package/dist/model/malloy_types.js +81 -84
- package/dist/model/sql_block.d.ts +4 -4
- package/dist/model/sql_block.js +9 -12
- package/dist/tags.js +2 -2
- package/package.json +1 -1
- package/dist/lang/ast/space-seed.d.ts +0 -16
- package/dist/lang/ast/space-seed.js +0 -59
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { ParseTreeListener } from "antlr4ts/tree/ParseTreeListener";
|
|
2
|
+
import { RecordRefContext } from "./MalloyParser";
|
|
3
|
+
import { RecordExprContext } from "./MalloyParser";
|
|
2
4
|
import { VSegContext } from "./MalloyParser";
|
|
3
5
|
import { VArrowContext } from "./MalloyParser";
|
|
4
6
|
import { Use_top_level_query_defsContext } from "./MalloyParser";
|
|
@@ -21,8 +23,8 @@ import { TableFunctionContext } from "./MalloyParser";
|
|
|
21
23
|
import { TableMethodContext } from "./MalloyParser";
|
|
22
24
|
import { NestDefContext } from "./MalloyParser";
|
|
23
25
|
import { ExprFieldPathContext } from "./MalloyParser";
|
|
24
|
-
import { ExprFieldPropsContext } from "./MalloyParser";
|
|
25
26
|
import { ExprLiteralContext } from "./MalloyParser";
|
|
27
|
+
import { ExprFieldPropsContext } from "./MalloyParser";
|
|
26
28
|
import { ExprDurationContext } from "./MalloyParser";
|
|
27
29
|
import { ExprTimeTruncContext } from "./MalloyParser";
|
|
28
30
|
import { ExprCastContext } from "./MalloyParser";
|
|
@@ -195,6 +197,8 @@ import { FieldExprContext } from "./MalloyParser";
|
|
|
195
197
|
import { PartialAllowedFieldExprContext } from "./MalloyParser";
|
|
196
198
|
import { PickStatementContext } from "./MalloyParser";
|
|
197
199
|
import { PickContext } from "./MalloyParser";
|
|
200
|
+
import { RecordKeyContext } from "./MalloyParser";
|
|
201
|
+
import { RecordElementContext } from "./MalloyParser";
|
|
198
202
|
import { ArgumentListContext } from "./MalloyParser";
|
|
199
203
|
import { FieldNameListContext } from "./MalloyParser";
|
|
200
204
|
import { FieldCollectionContext } from "./MalloyParser";
|
|
@@ -216,6 +220,30 @@ import { ExperimentalStatementForTestingContext } from "./MalloyParser";
|
|
|
216
220
|
* `MalloyParser`.
|
|
217
221
|
*/
|
|
218
222
|
export interface MalloyParserListener extends ParseTreeListener {
|
|
223
|
+
/**
|
|
224
|
+
* Enter a parse tree produced by the `recordRef`
|
|
225
|
+
* labeled alternative in `MalloyParser.recordElement`.
|
|
226
|
+
* @param ctx the parse tree
|
|
227
|
+
*/
|
|
228
|
+
enterRecordRef?: (ctx: RecordRefContext) => void;
|
|
229
|
+
/**
|
|
230
|
+
* Exit a parse tree produced by the `recordRef`
|
|
231
|
+
* labeled alternative in `MalloyParser.recordElement`.
|
|
232
|
+
* @param ctx the parse tree
|
|
233
|
+
*/
|
|
234
|
+
exitRecordRef?: (ctx: RecordRefContext) => void;
|
|
235
|
+
/**
|
|
236
|
+
* Enter a parse tree produced by the `recordExpr`
|
|
237
|
+
* labeled alternative in `MalloyParser.recordElement`.
|
|
238
|
+
* @param ctx the parse tree
|
|
239
|
+
*/
|
|
240
|
+
enterRecordExpr?: (ctx: RecordExprContext) => void;
|
|
241
|
+
/**
|
|
242
|
+
* Exit a parse tree produced by the `recordExpr`
|
|
243
|
+
* labeled alternative in `MalloyParser.recordElement`.
|
|
244
|
+
* @param ctx the parse tree
|
|
245
|
+
*/
|
|
246
|
+
exitRecordExpr?: (ctx: RecordExprContext) => void;
|
|
219
247
|
/**
|
|
220
248
|
* Enter a parse tree produced by the `VSeg`
|
|
221
249
|
* labeled alternative in `MalloyParser.vExpr`.
|
|
@@ -481,29 +509,29 @@ export interface MalloyParserListener extends ParseTreeListener {
|
|
|
481
509
|
*/
|
|
482
510
|
exitExprFieldPath?: (ctx: ExprFieldPathContext) => void;
|
|
483
511
|
/**
|
|
484
|
-
* Enter a parse tree produced by the `
|
|
512
|
+
* Enter a parse tree produced by the `exprLiteral`
|
|
485
513
|
* labeled alternative in `MalloyParser.fieldExpr`.
|
|
486
514
|
* @param ctx the parse tree
|
|
487
515
|
*/
|
|
488
|
-
|
|
516
|
+
enterExprLiteral?: (ctx: ExprLiteralContext) => void;
|
|
489
517
|
/**
|
|
490
|
-
* Exit a parse tree produced by the `
|
|
518
|
+
* Exit a parse tree produced by the `exprLiteral`
|
|
491
519
|
* labeled alternative in `MalloyParser.fieldExpr`.
|
|
492
520
|
* @param ctx the parse tree
|
|
493
521
|
*/
|
|
494
|
-
|
|
522
|
+
exitExprLiteral?: (ctx: ExprLiteralContext) => void;
|
|
495
523
|
/**
|
|
496
|
-
* Enter a parse tree produced by the `
|
|
524
|
+
* Enter a parse tree produced by the `exprFieldProps`
|
|
497
525
|
* labeled alternative in `MalloyParser.fieldExpr`.
|
|
498
526
|
* @param ctx the parse tree
|
|
499
527
|
*/
|
|
500
|
-
|
|
528
|
+
enterExprFieldProps?: (ctx: ExprFieldPropsContext) => void;
|
|
501
529
|
/**
|
|
502
|
-
* Exit a parse tree produced by the `
|
|
530
|
+
* Exit a parse tree produced by the `exprFieldProps`
|
|
503
531
|
* labeled alternative in `MalloyParser.fieldExpr`.
|
|
504
532
|
* @param ctx the parse tree
|
|
505
533
|
*/
|
|
506
|
-
|
|
534
|
+
exitExprFieldProps?: (ctx: ExprFieldPropsContext) => void;
|
|
507
535
|
/**
|
|
508
536
|
* Enter a parse tree produced by the `exprDuration`
|
|
509
537
|
* labeled alternative in `MalloyParser.fieldExpr`.
|
|
@@ -2332,6 +2360,26 @@ export interface MalloyParserListener extends ParseTreeListener {
|
|
|
2332
2360
|
* @param ctx the parse tree
|
|
2333
2361
|
*/
|
|
2334
2362
|
exitPick?: (ctx: PickContext) => void;
|
|
2363
|
+
/**
|
|
2364
|
+
* Enter a parse tree produced by `MalloyParser.recordKey`.
|
|
2365
|
+
* @param ctx the parse tree
|
|
2366
|
+
*/
|
|
2367
|
+
enterRecordKey?: (ctx: RecordKeyContext) => void;
|
|
2368
|
+
/**
|
|
2369
|
+
* Exit a parse tree produced by `MalloyParser.recordKey`.
|
|
2370
|
+
* @param ctx the parse tree
|
|
2371
|
+
*/
|
|
2372
|
+
exitRecordKey?: (ctx: RecordKeyContext) => void;
|
|
2373
|
+
/**
|
|
2374
|
+
* Enter a parse tree produced by `MalloyParser.recordElement`.
|
|
2375
|
+
* @param ctx the parse tree
|
|
2376
|
+
*/
|
|
2377
|
+
enterRecordElement?: (ctx: RecordElementContext) => void;
|
|
2378
|
+
/**
|
|
2379
|
+
* Exit a parse tree produced by `MalloyParser.recordElement`.
|
|
2380
|
+
* @param ctx the parse tree
|
|
2381
|
+
*/
|
|
2382
|
+
exitRecordElement?: (ctx: RecordElementContext) => void;
|
|
2335
2383
|
/**
|
|
2336
2384
|
* Enter a parse tree produced by `MalloyParser.argumentList`.
|
|
2337
2385
|
* @param ctx the parse tree
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { ParseTreeVisitor } from "antlr4ts/tree/ParseTreeVisitor";
|
|
2
|
+
import { RecordRefContext } from "./MalloyParser";
|
|
3
|
+
import { RecordExprContext } from "./MalloyParser";
|
|
2
4
|
import { VSegContext } from "./MalloyParser";
|
|
3
5
|
import { VArrowContext } from "./MalloyParser";
|
|
4
6
|
import { Use_top_level_query_defsContext } from "./MalloyParser";
|
|
@@ -21,8 +23,8 @@ import { TableFunctionContext } from "./MalloyParser";
|
|
|
21
23
|
import { TableMethodContext } from "./MalloyParser";
|
|
22
24
|
import { NestDefContext } from "./MalloyParser";
|
|
23
25
|
import { ExprFieldPathContext } from "./MalloyParser";
|
|
24
|
-
import { ExprFieldPropsContext } from "./MalloyParser";
|
|
25
26
|
import { ExprLiteralContext } from "./MalloyParser";
|
|
27
|
+
import { ExprFieldPropsContext } from "./MalloyParser";
|
|
26
28
|
import { ExprDurationContext } from "./MalloyParser";
|
|
27
29
|
import { ExprTimeTruncContext } from "./MalloyParser";
|
|
28
30
|
import { ExprCastContext } from "./MalloyParser";
|
|
@@ -195,6 +197,8 @@ import { FieldExprContext } from "./MalloyParser";
|
|
|
195
197
|
import { PartialAllowedFieldExprContext } from "./MalloyParser";
|
|
196
198
|
import { PickStatementContext } from "./MalloyParser";
|
|
197
199
|
import { PickContext } from "./MalloyParser";
|
|
200
|
+
import { RecordKeyContext } from "./MalloyParser";
|
|
201
|
+
import { RecordElementContext } from "./MalloyParser";
|
|
198
202
|
import { ArgumentListContext } from "./MalloyParser";
|
|
199
203
|
import { FieldNameListContext } from "./MalloyParser";
|
|
200
204
|
import { FieldCollectionContext } from "./MalloyParser";
|
|
@@ -219,6 +223,20 @@ import { ExperimentalStatementForTestingContext } from "./MalloyParser";
|
|
|
219
223
|
* operations with no return type.
|
|
220
224
|
*/
|
|
221
225
|
export interface MalloyParserVisitor<Result> extends ParseTreeVisitor<Result> {
|
|
226
|
+
/**
|
|
227
|
+
* Visit a parse tree produced by the `recordRef`
|
|
228
|
+
* labeled alternative in `MalloyParser.recordElement`.
|
|
229
|
+
* @param ctx the parse tree
|
|
230
|
+
* @return the visitor result
|
|
231
|
+
*/
|
|
232
|
+
visitRecordRef?: (ctx: RecordRefContext) => Result;
|
|
233
|
+
/**
|
|
234
|
+
* Visit a parse tree produced by the `recordExpr`
|
|
235
|
+
* labeled alternative in `MalloyParser.recordElement`.
|
|
236
|
+
* @param ctx the parse tree
|
|
237
|
+
* @return the visitor result
|
|
238
|
+
*/
|
|
239
|
+
visitRecordExpr?: (ctx: RecordExprContext) => Result;
|
|
222
240
|
/**
|
|
223
241
|
* Visit a parse tree produced by the `VSeg`
|
|
224
242
|
* labeled alternative in `MalloyParser.vExpr`.
|
|
@@ -374,19 +392,19 @@ export interface MalloyParserVisitor<Result> extends ParseTreeVisitor<Result> {
|
|
|
374
392
|
*/
|
|
375
393
|
visitExprFieldPath?: (ctx: ExprFieldPathContext) => Result;
|
|
376
394
|
/**
|
|
377
|
-
* Visit a parse tree produced by the `
|
|
395
|
+
* Visit a parse tree produced by the `exprLiteral`
|
|
378
396
|
* labeled alternative in `MalloyParser.fieldExpr`.
|
|
379
397
|
* @param ctx the parse tree
|
|
380
398
|
* @return the visitor result
|
|
381
399
|
*/
|
|
382
|
-
|
|
400
|
+
visitExprLiteral?: (ctx: ExprLiteralContext) => Result;
|
|
383
401
|
/**
|
|
384
|
-
* Visit a parse tree produced by the `
|
|
402
|
+
* Visit a parse tree produced by the `exprFieldProps`
|
|
385
403
|
* labeled alternative in `MalloyParser.fieldExpr`.
|
|
386
404
|
* @param ctx the parse tree
|
|
387
405
|
* @return the visitor result
|
|
388
406
|
*/
|
|
389
|
-
|
|
407
|
+
visitExprFieldProps?: (ctx: ExprFieldPropsContext) => Result;
|
|
390
408
|
/**
|
|
391
409
|
* Visit a parse tree produced by the `exprDuration`
|
|
392
410
|
* labeled alternative in `MalloyParser.fieldExpr`.
|
|
@@ -1473,6 +1491,18 @@ export interface MalloyParserVisitor<Result> extends ParseTreeVisitor<Result> {
|
|
|
1473
1491
|
* @return the visitor result
|
|
1474
1492
|
*/
|
|
1475
1493
|
visitPick?: (ctx: PickContext) => Result;
|
|
1494
|
+
/**
|
|
1495
|
+
* Visit a parse tree produced by `MalloyParser.recordKey`.
|
|
1496
|
+
* @param ctx the parse tree
|
|
1497
|
+
* @return the visitor result
|
|
1498
|
+
*/
|
|
1499
|
+
visitRecordKey?: (ctx: RecordKeyContext) => Result;
|
|
1500
|
+
/**
|
|
1501
|
+
* Visit a parse tree produced by `MalloyParser.recordElement`.
|
|
1502
|
+
* @param ctx the parse tree
|
|
1503
|
+
* @return the visitor result
|
|
1504
|
+
*/
|
|
1505
|
+
visitRecordElement?: (ctx: RecordElementContext) => Result;
|
|
1476
1506
|
/**
|
|
1477
1507
|
* Visit a parse tree produced by `MalloyParser.argumentList`.
|
|
1478
1508
|
* @param ctx the parse tree
|
|
@@ -88,10 +88,10 @@ export declare class MalloyToAST extends AbstractParseTreeVisitor<ast.MalloyElem
|
|
|
88
88
|
visitTableFunction(pcx: parse.TableFunctionContext): ast.TableSource;
|
|
89
89
|
visitTableMethod(pcx: parse.TableMethodContext): ast.TableSource;
|
|
90
90
|
visitSqlSource(pcx: parse.SqlSourceContext): ast.SQLSource;
|
|
91
|
-
visitDefJoinMany(pcx: parse.DefJoinManyContext): ast.
|
|
92
|
-
visitDefJoinOne(pcx: parse.DefJoinOneContext): ast.
|
|
93
|
-
visitDefJoinCross(pcx: parse.DefJoinCrossContext): ast.
|
|
94
|
-
protected getJoinList(pcx: parse.JoinListContext): ast.
|
|
91
|
+
visitDefJoinMany(pcx: parse.DefJoinManyContext): ast.JoinStatement;
|
|
92
|
+
visitDefJoinOne(pcx: parse.DefJoinOneContext): ast.JoinStatement;
|
|
93
|
+
visitDefJoinCross(pcx: parse.DefJoinCrossContext): ast.JoinStatement;
|
|
94
|
+
protected getJoinList(pcx: parse.JoinListContext): ast.Join[];
|
|
95
95
|
protected getJoinFrom(cx: parse.JoinFromContext): {
|
|
96
96
|
joinAs: ast.ModelEntryReference;
|
|
97
97
|
joinFrom: ast.SourceQueryElement;
|
|
@@ -360,7 +360,7 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
360
360
|
}
|
|
361
361
|
}
|
|
362
362
|
}
|
|
363
|
-
const joinMany = new ast.
|
|
363
|
+
const joinMany = new ast.JoinStatement(joins);
|
|
364
364
|
joinMany.extendNote({ blockNotes: this.getNotes(pcx.tags()) });
|
|
365
365
|
return joinMany;
|
|
366
366
|
}
|
|
@@ -375,7 +375,7 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
375
375
|
}
|
|
376
376
|
}
|
|
377
377
|
}
|
|
378
|
-
const joinOne = new ast.
|
|
378
|
+
const joinOne = new ast.JoinStatement(joins);
|
|
379
379
|
joinOne.extendNote({ blockNotes: this.getNotes(pcx.tags()) });
|
|
380
380
|
return joinOne;
|
|
381
381
|
}
|
|
@@ -393,12 +393,12 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
393
393
|
}
|
|
394
394
|
}
|
|
395
395
|
}
|
|
396
|
-
const joinCross = new ast.
|
|
396
|
+
const joinCross = new ast.JoinStatement(joins);
|
|
397
397
|
joinCross.extendNote({ blockNotes: this.getNotes(pcx.tags()) });
|
|
398
398
|
return joinCross;
|
|
399
399
|
}
|
|
400
400
|
getJoinList(pcx) {
|
|
401
|
-
return pcx.joinDef().map(
|
|
401
|
+
return this.only(pcx.joinDef().map(scx => this.visit(scx)), x => x instanceof ast.Join && x, 'join');
|
|
402
402
|
}
|
|
403
403
|
getJoinFrom(cx) {
|
|
404
404
|
const ecx = cx.isExplore();
|
|
@@ -1312,6 +1312,34 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
1312
1312
|
this.inExperiment('compilerTestExperimentParse', pcx);
|
|
1313
1313
|
return this.astAt(new ast.ExperimentalExperiment('compilerTestExperimentTranslate'), pcx);
|
|
1314
1314
|
}
|
|
1315
|
+
// visitRecordRef(pcx: parse.RecordRefContext) {
|
|
1316
|
+
// const pathCx = pcx.fieldPath();
|
|
1317
|
+
// const tailEl = pathCx.fieldName().at(-1);
|
|
1318
|
+
// if (tailEl) {
|
|
1319
|
+
// const elementKey = getId(tailEl);
|
|
1320
|
+
// const idRef = new ast.ExprIdReference(
|
|
1321
|
+
// this.getFieldPath(pathCx, ast.ExpressionFieldReference)
|
|
1322
|
+
// );
|
|
1323
|
+
// return new ast.RecordElement(elementKey, idRef);
|
|
1324
|
+
// }
|
|
1325
|
+
// throw this.internalError(
|
|
1326
|
+
// pathCx,
|
|
1327
|
+
// 'IMPOSSIBLY A PATH CONTAINED ZERO ELEMENTS'
|
|
1328
|
+
// );
|
|
1329
|
+
// }
|
|
1330
|
+
// visitRecordExpr(pcx: parse.RecordExprContext) {
|
|
1331
|
+
// const elementKey = getId(pcx.recordKey());
|
|
1332
|
+
// const elementVal = this.getFieldExpr(pcx.fieldExpr());
|
|
1333
|
+
// return new ast.RecordElement(elementKey, elementVal);
|
|
1334
|
+
// }
|
|
1335
|
+
// visitExprLiteralRecord(pcx: parse.ExprLiteralRecordContext) {
|
|
1336
|
+
// const els = this.only<ast.RecordElement>(
|
|
1337
|
+
// pcx.recordElement().map(elCx => this.astAt(this.visit(elCx), elCx)),
|
|
1338
|
+
// visited => visited instanceof ast.RecordElement && visited,
|
|
1339
|
+
// 'a key value pair'
|
|
1340
|
+
// );
|
|
1341
|
+
// return new ast.RecordLiteral(els);
|
|
1342
|
+
// }
|
|
1315
1343
|
visitExprWarnLike(pcx) {
|
|
1316
1344
|
let op = '~';
|
|
1317
1345
|
const left = pcx.fieldExpr(0);
|
package/dist/lang/parse-log.d.ts
CHANGED
|
@@ -104,9 +104,7 @@ type MessageParameterTypes = {
|
|
|
104
104
|
'mismatched-coalesce-types': string;
|
|
105
105
|
'function-not-found': string;
|
|
106
106
|
'case-insensitive-function': string;
|
|
107
|
-
'
|
|
108
|
-
'connection-not-callable': string;
|
|
109
|
-
'query-not-callable': string;
|
|
107
|
+
'call-of-non-function': string;
|
|
110
108
|
'no-matching-function-overload': string;
|
|
111
109
|
'invalid-function-argument-expression-type': string;
|
|
112
110
|
'invalid-function-argument-evaluation-space': string;
|
|
@@ -217,7 +215,7 @@ type MessageParameterTypes = {
|
|
|
217
215
|
'invalid-source-from-query': string;
|
|
218
216
|
'invalid-source-from-function': string;
|
|
219
217
|
'invalid-source-from-connection': string;
|
|
220
|
-
'invalid-source-
|
|
218
|
+
'invalid-source-source': string;
|
|
221
219
|
'unnamed-source-argument': string;
|
|
222
220
|
'duplicate-source-argument': string;
|
|
223
221
|
'source-parameter-not-found': string;
|
|
@@ -243,13 +241,10 @@ type MessageParameterTypes = {
|
|
|
243
241
|
'failed-to-compute-arrow-source': string;
|
|
244
242
|
'failed-to-compute-source-from-query': string;
|
|
245
243
|
'failed-to-compute-source-to-extend': string;
|
|
246
|
-
'cannot-use-
|
|
247
|
-
'cannot-use-struct-as-query': string;
|
|
248
|
-
'cannot-use-connection-as-query': string;
|
|
244
|
+
'cannot-use-as-query': string;
|
|
249
245
|
'source-or-query-not-found': string;
|
|
250
246
|
'illegal-query-argument': string;
|
|
251
|
-
'cannot-use-
|
|
252
|
-
'cannot-use-connection-as-source': string;
|
|
247
|
+
'cannot-use-struct-as-source': string;
|
|
253
248
|
'illegal-refinement-of-source': string;
|
|
254
249
|
'invalid-source-as-query': string;
|
|
255
250
|
'invalid-sql-source-interpolation': string;
|
|
@@ -319,6 +314,7 @@ type MessageParameterTypes = {
|
|
|
319
314
|
'sql-like': string;
|
|
320
315
|
'sql-is-not-null': string;
|
|
321
316
|
'sql-is-null': string;
|
|
317
|
+
'illegal-record-property-type': string;
|
|
322
318
|
};
|
|
323
319
|
export declare const MESSAGE_FORMATTERS: PartialErrorCodeMessageMap;
|
|
324
320
|
export type MessageCode = keyof MessageParameterTypes;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ANTLRErrorListener, ParserRuleContext, Token } from 'antlr4ts';
|
|
2
|
-
import { DocumentLocation, DocumentPosition, DocumentRange, DocumentReference, ImportLocation, ModelDef, NamedModelObject, Query,
|
|
3
|
-
import { LogMessage, LogMessageOptions, MessageCode, MessageLogger, MessageParameterType } from './parse-log';
|
|
2
|
+
import { DocumentLocation, DocumentPosition, DocumentRange, DocumentReference, ImportLocation, ModelDef, NamedModelObject, Query, SourceDef, SQLSourceDef } from '../model/malloy_types';
|
|
3
|
+
import { BaseMessageLogger, LogMessage, LogMessageOptions, MessageCode, MessageLogger, MessageParameterType } from './parse-log';
|
|
4
4
|
import { Zone, ZoneData } from './zone';
|
|
5
5
|
import { ReferenceList } from './reference-list';
|
|
6
6
|
import { ASTResponse, CompletionsResponse, DataRequestResponse, ProblemResponse, FatalResponse, FinalResponse, HelpContextResponse, MetadataResponse, ModelDataRequest, NeedURLData, TranslateResponse, ModelAnnotationResponse, TablePathResponse } from './translate-response';
|
|
@@ -111,7 +111,7 @@ export declare abstract class MalloyTranslation {
|
|
|
111
111
|
childTranslators: Map<string, MalloyTranslation>;
|
|
112
112
|
urlIsFullPath?: boolean;
|
|
113
113
|
queryList: Query[];
|
|
114
|
-
sqlBlocks:
|
|
114
|
+
sqlBlocks: SQLSourceDef[];
|
|
115
115
|
modelDef: ModelDef;
|
|
116
116
|
imports: ImportLocation[];
|
|
117
117
|
compilerFlags: Tag;
|
|
@@ -186,10 +186,10 @@ export declare class MalloyChildTranslator extends MalloyTranslation {
|
|
|
186
186
|
*/
|
|
187
187
|
export declare class MalloyTranslator extends MalloyTranslation {
|
|
188
188
|
private readonly eventStream;
|
|
189
|
-
schemaZone: Zone<
|
|
189
|
+
schemaZone: Zone<SourceDef>;
|
|
190
190
|
importZone: Zone<string>;
|
|
191
|
-
sqlQueryZone: Zone<
|
|
192
|
-
logger:
|
|
191
|
+
sqlQueryZone: Zone<SQLSourceDef>;
|
|
192
|
+
logger: BaseMessageLogger;
|
|
193
193
|
readonly root: MalloyTranslator;
|
|
194
194
|
constructor(rootURL: string, importURL?: string | null, preload?: ParseUpdate | null, eventStream?: EventStream | null);
|
|
195
195
|
update(dd: ParseUpdate): void;
|
|
@@ -204,12 +204,12 @@ export interface URLData {
|
|
|
204
204
|
urls: ZoneData<string>;
|
|
205
205
|
}
|
|
206
206
|
export interface SchemaData {
|
|
207
|
-
tables: ZoneData<
|
|
207
|
+
tables: ZoneData<SourceDef>;
|
|
208
208
|
}
|
|
209
|
-
export interface
|
|
210
|
-
compileSQL: ZoneData<
|
|
209
|
+
export interface SQLSources {
|
|
210
|
+
compileSQL: ZoneData<SQLSourceDef>;
|
|
211
211
|
}
|
|
212
|
-
export interface UpdateData extends URLData, SchemaData,
|
|
212
|
+
export interface UpdateData extends URLData, SchemaData, SQLSources {
|
|
213
213
|
errors: Partial<ErrorData>;
|
|
214
214
|
}
|
|
215
215
|
export type ParseUpdate = Partial<UpdateData>;
|
|
@@ -47,6 +47,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
47
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
48
|
exports.MalloyParserErrorHandler = exports.MalloyTranslator = exports.MalloyChildTranslator = exports.MalloyTranslation = void 0;
|
|
49
49
|
const antlr4ts_1 = require("antlr4ts");
|
|
50
|
+
const malloy_types_1 = require("../model/malloy_types");
|
|
50
51
|
const MalloyLexer_1 = require("./lib/Malloy/MalloyLexer");
|
|
51
52
|
const MalloyParser_1 = require("./lib/Malloy/MalloyParser");
|
|
52
53
|
const ast = __importStar(require("./ast"));
|
|
@@ -679,7 +680,7 @@ class MalloyTranslation {
|
|
|
679
680
|
if (did.translated) {
|
|
680
681
|
for (const fromChild of child.modelDef.exports) {
|
|
681
682
|
const modelEntry = child.modelDef.contents[fromChild];
|
|
682
|
-
if (modelEntry
|
|
683
|
+
if ((0, malloy_types_1.modelObjIsSource)(modelEntry) || modelEntry.type === 'query') {
|
|
683
684
|
exports[fromChild] = modelEntry;
|
|
684
685
|
}
|
|
685
686
|
}
|
|
@@ -40,6 +40,12 @@ expect.extend({
|
|
|
40
40
|
}
|
|
41
41
|
return clean;
|
|
42
42
|
}
|
|
43
|
+
if (result === undefined) {
|
|
44
|
+
return {
|
|
45
|
+
pass: false,
|
|
46
|
+
message: () => 'Annotation was undefined',
|
|
47
|
+
};
|
|
48
|
+
}
|
|
43
49
|
const got = stripAt(result);
|
|
44
50
|
if (!this.equals(got, shouldBe)) {
|
|
45
51
|
return {
|
|
@@ -412,7 +418,7 @@ describe('query operation annotations', () => {
|
|
|
412
418
|
expect(note_a === null || note_a === void 0 ? void 0 : note_a.annotation).matchesAnnotation(defaultTags);
|
|
413
419
|
}
|
|
414
420
|
});
|
|
415
|
-
test('
|
|
421
|
+
test('select: ref inherits annotation', () => {
|
|
416
422
|
const m = new test_translator_1.TestTranslator(`
|
|
417
423
|
run: a extend {
|
|
418
424
|
# blockNote
|
|
@@ -34,11 +34,11 @@ const space_param_1 = require("../ast/types/space-param");
|
|
|
34
34
|
describe('structdef comprehension', () => {
|
|
35
35
|
function mkStructDef(field) {
|
|
36
36
|
return {
|
|
37
|
-
type: '
|
|
37
|
+
type: 'table',
|
|
38
38
|
name: 'test',
|
|
39
39
|
dialect: 'standardsql',
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
tablePath: 'test',
|
|
41
|
+
connection: 'test',
|
|
42
42
|
fields: [field],
|
|
43
43
|
};
|
|
44
44
|
}
|
|
@@ -102,17 +102,14 @@ describe('structdef comprehension', () => {
|
|
|
102
102
|
const oField = space.structDef().fields[0];
|
|
103
103
|
expect(oField).toEqual(field);
|
|
104
104
|
});
|
|
105
|
-
test('import
|
|
105
|
+
test('import repeated record', () => {
|
|
106
106
|
const field = {
|
|
107
107
|
name: 't',
|
|
108
|
-
type: '
|
|
108
|
+
type: 'array',
|
|
109
109
|
dialect: 'standardsql',
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
isArray: false,
|
|
114
|
-
},
|
|
115
|
-
structSource: { type: 'nested' },
|
|
110
|
+
elementTypeDef: { type: 'string' },
|
|
111
|
+
join: 'many',
|
|
112
|
+
matrixOperation: 'left',
|
|
116
113
|
fields: [{ type: 'string', name: 'b' }],
|
|
117
114
|
};
|
|
118
115
|
const struct = mkStructDef(field);
|
|
@@ -124,10 +121,10 @@ describe('structdef comprehension', () => {
|
|
|
124
121
|
test('import inline field', () => {
|
|
125
122
|
const field = {
|
|
126
123
|
name: 't',
|
|
127
|
-
type: '
|
|
124
|
+
type: 'record',
|
|
128
125
|
dialect: 'standardsql',
|
|
129
|
-
|
|
130
|
-
|
|
126
|
+
join: 'one',
|
|
127
|
+
matrixOperation: 'left',
|
|
131
128
|
fields: [{ type: 'string', name: 'a' }],
|
|
132
129
|
};
|
|
133
130
|
const struct = mkStructDef(field);
|
|
@@ -139,20 +136,19 @@ describe('structdef comprehension', () => {
|
|
|
139
136
|
test('import join field', () => {
|
|
140
137
|
const field = {
|
|
141
138
|
name: 't',
|
|
142
|
-
type: '
|
|
139
|
+
type: 'table',
|
|
143
140
|
dialect: 'standardsql',
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
},
|
|
141
|
+
connection: 'test',
|
|
142
|
+
join: 'one',
|
|
143
|
+
matrixOperation: 'left',
|
|
144
|
+
onExpression: {
|
|
145
|
+
node: '=',
|
|
146
|
+
kids: {
|
|
147
|
+
left: { node: 'field', path: ['aKey'] },
|
|
148
|
+
right: { node: 'field', path: ['t', 'a'] },
|
|
153
149
|
},
|
|
154
150
|
},
|
|
155
|
-
|
|
151
|
+
tablePath: 't',
|
|
156
152
|
fields: [{ type: 'string', name: 'a' }],
|
|
157
153
|
};
|
|
158
154
|
const struct = mkStructDef(field);
|
|
@@ -25,6 +25,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
25
25
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
26
26
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
27
27
|
*/
|
|
28
|
+
const model_1 = require("../../model");
|
|
28
29
|
require("./parse-expects");
|
|
29
30
|
const test_translator_1 = require("./test-translator");
|
|
30
31
|
const escapeRegExp_1 = __importDefault(require("lodash/escapeRegExp"));
|
|
@@ -88,13 +89,14 @@ source: botProjQSrc is botProjQ
|
|
|
88
89
|
});
|
|
89
90
|
expect(docParse).toTranslate();
|
|
90
91
|
const newSrc = docParse.getSourceDef('newSrc');
|
|
91
|
-
const
|
|
92
|
-
expect(
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
92
|
+
const maybeField = newSrc === null || newSrc === void 0 ? void 0 : newSrc.fields.find(f => f.name === 'b');
|
|
93
|
+
expect(maybeField).toBeDefined();
|
|
94
|
+
const f = maybeField;
|
|
95
|
+
expect((0, model_1.isJoined)(f)).toBeTruthy();
|
|
96
|
+
if ((0, model_1.isJoined)(f)) {
|
|
97
|
+
expect(f.type).toBe('query_source');
|
|
98
|
+
if (f.type === 'query_source') {
|
|
99
|
+
expect(typeof f.query.structRef).not.toBe('string');
|
|
98
100
|
}
|
|
99
101
|
}
|
|
100
102
|
});
|
|
@@ -176,9 +178,9 @@ source: botProjQSrc is botProjQ
|
|
|
176
178
|
const ms = fullModel.getSourceDef('midSrc');
|
|
177
179
|
expect(ms).toBeDefined();
|
|
178
180
|
if (ms) {
|
|
179
|
-
expect(ms.
|
|
180
|
-
if (ms.
|
|
181
|
-
const qs = ms.
|
|
181
|
+
expect(ms.type).toBe('query_source');
|
|
182
|
+
if (ms.type === 'query_source') {
|
|
183
|
+
const qs = ms.query.structRef;
|
|
182
184
|
expect(typeof qs).not.toBe('string');
|
|
183
185
|
}
|
|
184
186
|
}
|
|
@@ -217,7 +217,7 @@ describe('lenses', () => {
|
|
|
217
217
|
join_one: y is a on true
|
|
218
218
|
view: m is { aggregate: c is count() }
|
|
219
219
|
}
|
|
220
|
-
run: x -> m + y + { limit: 1 }`).toLog((0, test_translator_1.errorMessage)('named refinement `y` must be a view, found a
|
|
220
|
+
run: x -> m + y + { limit: 1 }`).toLog((0, test_translator_1.errorMessage)('named refinement `y` must be a view, found a table'));
|
|
221
221
|
});
|
|
222
222
|
test('cannot use view from join as whole pipeline', () => {
|
|
223
223
|
expect((0, test_translator_1.markSource) `
|
|
@@ -286,7 +286,7 @@ describe('lenses', () => {
|
|
|
286
286
|
view: d is { group_by: n }
|
|
287
287
|
}
|
|
288
288
|
run: x -> d + b
|
|
289
|
-
`).toLog((0, test_translator_1.errorMessage)('named refinement `b` must be a view, found a
|
|
289
|
+
`).toLog((0, test_translator_1.errorMessage)('named refinement `b` must be a view, found a table'));
|
|
290
290
|
});
|
|
291
291
|
test('cannot reference field in LHS of refinement in group_by', () => {
|
|
292
292
|
expect((0, test_translator_1.markSource) `
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { StructDef } from '../../model/malloy_types';
|
|
2
|
-
export declare const CHILD_EXPLORE:
|
|
3
|
-
export declare const PARENT_EXPLORE:
|
|
4
|
-
export declare const
|
|
1
|
+
import { StructDef, TableSourceDef } from '../../model/malloy_types';
|
|
2
|
+
export declare const CHILD_EXPLORE: TableSourceDef;
|
|
3
|
+
export declare const PARENT_EXPLORE: TableSourceDef;
|
|
4
|
+
export declare const GRANDPARENT_EXPLORE: TableSourceDef;
|
|
5
5
|
export declare const SOURCE_EXPLORE: StructDef;
|