@malloydata/malloy 0.0.422 → 0.0.423
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/README.md +3 -3
- package/dist/dialect/databricks/databricks.js +9 -2
- package/dist/dialect/mysql/mysql.js +9 -2
- package/dist/dialect/postgres/postgres.js +26 -0
- package/dist/dialect/snowflake/snowflake.js +30 -1
- package/dist/dialect/standardsql/standardsql.js +15 -0
- package/dist/dialect/trino/trino.js +5 -0
- package/dist/lang/ast/expressions/expr-time-extract.js +3 -2
- package/dist/lang/ast/field-space/include-utils.js +5 -5
- package/dist/lang/ast/field-space/query-spaces.js +1 -0
- package/dist/lang/ast/field-space/reference-field.js +1 -1
- package/dist/lang/ast/query-builders/project-builder.js +1 -2
- package/dist/lang/ast/query-elements/anonymous-query.d.ts +1 -3
- package/dist/lang/ast/query-elements/anonymous-query.js +1 -3
- package/dist/lang/ast/query-items/field-declaration.d.ts +1 -3
- package/dist/lang/ast/query-items/field-declaration.js +2 -4
- package/dist/lang/ast/query-items/field-references.d.ts +2 -5
- package/dist/lang/ast/query-items/field-references.js +2 -5
- package/dist/lang/ast/query-properties/aggregate.d.ts +1 -0
- package/dist/lang/ast/query-properties/aggregate.js +1 -0
- package/dist/lang/ast/query-properties/group-by.d.ts +1 -0
- package/dist/lang/ast/query-properties/group-by.js +1 -0
- package/dist/lang/ast/query-properties/indexing.d.ts +1 -0
- package/dist/lang/ast/query-properties/indexing.js +1 -0
- package/dist/lang/ast/query-properties/nest.d.ts +1 -0
- package/dist/lang/ast/query-properties/nest.js +2 -1
- package/dist/lang/ast/query-properties/nests.d.ts +1 -0
- package/dist/lang/ast/query-properties/nests.js +1 -0
- package/dist/lang/ast/query-properties/project-statement.d.ts +1 -0
- package/dist/lang/ast/query-properties/project-statement.js +1 -0
- package/dist/lang/ast/query-properties/qop-desc.js +12 -1
- package/dist/lang/ast/query-properties/sampling.d.ts +1 -0
- package/dist/lang/ast/query-properties/sampling.js +1 -0
- package/dist/lang/ast/source-properties/join.d.ts +1 -3
- package/dist/lang/ast/source-properties/join.js +4 -6
- package/dist/lang/ast/source-properties/renames.d.ts +2 -3
- package/dist/lang/ast/source-properties/renames.js +1 -3
- package/dist/lang/ast/source-properties/user-type-shape.d.ts +1 -3
- package/dist/lang/ast/source-properties/user-type-shape.js +5 -7
- package/dist/lang/ast/source-properties/view-field-declaration.d.ts +1 -3
- package/dist/lang/ast/source-properties/view-field-declaration.js +1 -3
- package/dist/lang/ast/source-query-elements/include-item.d.ts +2 -5
- package/dist/lang/ast/source-query-elements/include-item.js +0 -3
- package/dist/lang/ast/statements/define-given.d.ts +1 -3
- package/dist/lang/ast/statements/define-given.js +2 -4
- package/dist/lang/ast/statements/define-query.d.ts +1 -3
- package/dist/lang/ast/statements/define-query.js +3 -5
- package/dist/lang/ast/statements/define-source.d.ts +1 -3
- package/dist/lang/ast/statements/define-source.js +4 -6
- package/dist/lang/ast/statements/define-user-type.d.ts +1 -3
- package/dist/lang/ast/statements/define-user-type.js +2 -4
- package/dist/lang/ast/types/definition-list.d.ts +2 -4
- package/dist/lang/ast/types/definition-list.js +6 -11
- package/dist/lang/ast/types/malloy-element.d.ts +1 -3
- package/dist/lang/ast/types/malloy-element.js +2 -3
- package/dist/lang/ast/types/noteable.d.ts +3 -4
- package/dist/lang/ast/types/noteable.js +5 -7
- package/dist/lang/ast/types/query-property-interface.d.ts +1 -0
- package/dist/lang/composite-source-utils.js +1 -2
- package/dist/lang/malloy-to-ast.js +33 -32
- package/dist/model/filter_compilers.js +27 -1
- package/dist/model/malloy_types.d.ts +3 -3
- package/dist/model/query_query.d.ts +1 -1
- package/dist/model/query_query.js +7 -3
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
|
@@ -51,6 +51,7 @@ const malloy_tag_1 = require("@malloydata/malloy-tag");
|
|
|
51
51
|
const utils_1 = require("./utils");
|
|
52
52
|
const malloy_filter_1 = require("@malloydata/malloy-filter");
|
|
53
53
|
const timing_1 = require("../timing");
|
|
54
|
+
const noteable_1 = require("./ast/types/noteable");
|
|
54
55
|
class ErrorNode extends ast.SourceQueryElement {
|
|
55
56
|
constructor() {
|
|
56
57
|
super(...arguments);
|
|
@@ -290,7 +291,7 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
290
291
|
const defs = defsCx.map(dcx => this.visitSourceDefinition(dcx));
|
|
291
292
|
const blockNotes = this.getNotes(pcx.tags());
|
|
292
293
|
const defList = new ast.DefineSourceList(defs);
|
|
293
|
-
|
|
294
|
+
(0, noteable_1.extendOwnAnnotation)(defList, { blockNotes });
|
|
294
295
|
return defList;
|
|
295
296
|
}
|
|
296
297
|
visitDefineGivenStatement(pcx) {
|
|
@@ -300,7 +301,7 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
300
301
|
const blockNotes = this.getNotes(pcx.tags());
|
|
301
302
|
const block = new ast.DefineGivens(givens);
|
|
302
303
|
for (const g of givens) {
|
|
303
|
-
|
|
304
|
+
(0, noteable_1.extendOwnAnnotation)(g, { blockNotes });
|
|
304
305
|
}
|
|
305
306
|
return this.astAt(block, pcx);
|
|
306
307
|
}
|
|
@@ -342,7 +343,7 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
342
343
|
}
|
|
343
344
|
}
|
|
344
345
|
const decl = new ast.GivenDeclaration(name, typeDef, defVal, inline);
|
|
345
|
-
|
|
346
|
+
(0, noteable_1.extendOwnAnnotation)(decl, { notes: this.getNotes(pcx.tags()) });
|
|
346
347
|
return this.astAt(decl, pcx);
|
|
347
348
|
}
|
|
348
349
|
/**
|
|
@@ -390,14 +391,14 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
390
391
|
const defs = defsCx.map(dcx => this.visitUserTypeDefinition(dcx));
|
|
391
392
|
const blockNotes = this.getNotes(pcx.tags());
|
|
392
393
|
const defList = new ast.DefineUserTypeList(defs);
|
|
393
|
-
|
|
394
|
+
(0, noteable_1.extendOwnAnnotation)(defList, { blockNotes });
|
|
394
395
|
return defList;
|
|
395
396
|
}
|
|
396
397
|
visitUserTypeDefinition(pcx) {
|
|
397
398
|
const shape = this.getUserTypeShapeExpr(pcx.userTypeExpr());
|
|
398
399
|
const def = new ast.DefineUserType((0, parse_utils_1.getId)(pcx.userTypeNameDef()), shape, true);
|
|
399
400
|
const notes = this.getNotes(pcx.tags()).concat(this.getIsNotes(pcx.isDefine()));
|
|
400
|
-
|
|
401
|
+
(0, noteable_1.extendOwnAnnotation)(def, { notes });
|
|
401
402
|
return this.astAt(def, pcx);
|
|
402
403
|
}
|
|
403
404
|
getUserTypeShapeExpr(cx) {
|
|
@@ -437,7 +438,7 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
437
438
|
member = new ast.UserTypeMemberDef(name, typeResult);
|
|
438
439
|
}
|
|
439
440
|
const notes = this.getNotes(pcx.tags());
|
|
440
|
-
|
|
441
|
+
(0, noteable_1.extendOwnAnnotation)(member, { notes });
|
|
441
442
|
return this.astAt(member, pcx);
|
|
442
443
|
}
|
|
443
444
|
getUserTypeFieldType(pcx) {
|
|
@@ -523,7 +524,7 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
523
524
|
const params = this.getSourceParameters(pcx.sourceParameters());
|
|
524
525
|
const exploreDef = new ast.DefineSource((0, parse_utils_1.getId)(pcx.sourceNameDef()), exploreExpr instanceof ast.SourceQueryElement ? exploreExpr : undefined, true, params);
|
|
525
526
|
const notes = this.getNotes(pcx.tags()).concat(this.getIsNotes(pcx.isDefine()));
|
|
526
|
-
|
|
527
|
+
(0, noteable_1.extendOwnAnnotation)(exploreDef, { notes });
|
|
527
528
|
return this.astAt(exploreDef, pcx);
|
|
528
529
|
}
|
|
529
530
|
getSourceExtensions(extensions) {
|
|
@@ -581,7 +582,7 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
581
582
|
}
|
|
582
583
|
}
|
|
583
584
|
const joinMany = new ast.JoinStatement(joins, accessLabel);
|
|
584
|
-
|
|
585
|
+
(0, noteable_1.extendOwnAnnotation)(joinMany, { blockNotes: this.getNotes(pcx.tags()) });
|
|
585
586
|
return joinMany;
|
|
586
587
|
}
|
|
587
588
|
visitDefJoinOne(pcx) {
|
|
@@ -597,7 +598,7 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
597
598
|
}
|
|
598
599
|
}
|
|
599
600
|
const joinOne = new ast.JoinStatement(joins, accessLabel);
|
|
600
|
-
|
|
601
|
+
(0, noteable_1.extendOwnAnnotation)(joinOne, { blockNotes: this.getNotes(pcx.tags()) });
|
|
601
602
|
return joinOne;
|
|
602
603
|
}
|
|
603
604
|
visitDefJoinCross(pcx) {
|
|
@@ -616,7 +617,7 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
616
617
|
}
|
|
617
618
|
}
|
|
618
619
|
const joinCross = new ast.JoinStatement(joins, accessLabel);
|
|
619
|
-
|
|
620
|
+
(0, noteable_1.extendOwnAnnotation)(joinCross, { blockNotes: this.getNotes(pcx.tags()) });
|
|
620
621
|
return joinCross;
|
|
621
622
|
}
|
|
622
623
|
getJoinList(pcx) {
|
|
@@ -655,14 +656,14 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
655
656
|
if (onCx) {
|
|
656
657
|
join.joinOn = this.getFieldExpr(onCx);
|
|
657
658
|
}
|
|
658
|
-
|
|
659
|
+
(0, noteable_1.extendOwnAnnotation)(join, { notes: this.getNotes(pcx.tags()).concat(notes) });
|
|
659
660
|
return this.astAt(join, pcx);
|
|
660
661
|
}
|
|
661
662
|
visitJoinWith(pcx) {
|
|
662
663
|
const { joinAs, joinFrom, notes } = this.getJoinFrom(pcx.joinFrom());
|
|
663
664
|
const joinOn = this.getFieldExpr(pcx.fieldExpr());
|
|
664
665
|
const join = new ast.KeyJoin(joinAs, joinFrom, joinOn);
|
|
665
|
-
|
|
666
|
+
(0, noteable_1.extendOwnAnnotation)(join, { notes: this.getNotes(pcx.tags()).concat(notes) });
|
|
666
667
|
return this.astAt(join, pcx);
|
|
667
668
|
}
|
|
668
669
|
getFieldDef(pcx, makeFieldDef) {
|
|
@@ -671,14 +672,14 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
671
672
|
const valExpr = this.getFieldExpr(defCx);
|
|
672
673
|
const def = new makeFieldDef(valExpr, fieldName, this.getSourceCode(defCx));
|
|
673
674
|
const notes = this.getNotes(pcx.tags()).concat(this.getIsNotes(pcx.isDefine()));
|
|
674
|
-
|
|
675
|
+
(0, noteable_1.extendOwnAnnotation)(def, { notes });
|
|
675
676
|
return this.astAt(def, pcx);
|
|
676
677
|
}
|
|
677
678
|
visitDefDimensions(pcx) {
|
|
678
679
|
const accessLabel = this.getAccessLabel(pcx.accessLabel());
|
|
679
680
|
const defs = this.getFieldDefs(pcx.defList().fieldDef(), ast.DimensionFieldDeclaration);
|
|
680
681
|
const stmt = new ast.Dimensions(defs, accessLabel);
|
|
681
|
-
|
|
682
|
+
(0, noteable_1.extendOwnAnnotation)(stmt, { blockNotes: this.getNotes(pcx.tags()) });
|
|
682
683
|
return this.astAt(stmt, pcx);
|
|
683
684
|
}
|
|
684
685
|
getAccessLabel(pcx) {
|
|
@@ -707,7 +708,7 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
707
708
|
const accessLabel = this.getAccessLabel(pcx.accessLabel());
|
|
708
709
|
const defs = this.getFieldDefs(pcx.defList().fieldDef(), ast.MeasureFieldDeclaration);
|
|
709
710
|
const stmt = new ast.Measures(defs, accessLabel);
|
|
710
|
-
|
|
711
|
+
(0, noteable_1.extendOwnAnnotation)(stmt, { blockNotes: this.getNotes(pcx.tags()) });
|
|
711
712
|
return this.astAt(stmt, pcx);
|
|
712
713
|
}
|
|
713
714
|
visitQueryExtend(pcx) {
|
|
@@ -732,7 +733,7 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
732
733
|
const oldName = pcx.fieldName(1);
|
|
733
734
|
const rename = new ast.RenameField((0, parse_utils_1.getId)(newName), this.getFieldName(oldName));
|
|
734
735
|
const notes = this.getNotes(pcx.tags()).concat(this.getIsNotes(pcx.isDefine()));
|
|
735
|
-
|
|
736
|
+
(0, noteable_1.extendOwnAnnotation)(rename, { notes });
|
|
736
737
|
return this.astAt(rename, pcx);
|
|
737
738
|
}
|
|
738
739
|
visitDefExploreRename(pcx) {
|
|
@@ -741,7 +742,7 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
741
742
|
const renames = rcxs.map(rcx => this.visitRenameEntry(rcx));
|
|
742
743
|
const stmt = new ast.Renames(renames, accessLabel);
|
|
743
744
|
const blockNotes = this.getNotes(pcx.tags());
|
|
744
|
-
|
|
745
|
+
(0, noteable_1.extendOwnAnnotation)(stmt, { blockNotes });
|
|
745
746
|
return this.astAt(stmt, pcx);
|
|
746
747
|
}
|
|
747
748
|
visitFilterClauseList(pcx) {
|
|
@@ -772,7 +773,7 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
772
773
|
.map(cx => this.visitExploreQueryDef(cx));
|
|
773
774
|
const queryDefs = new ast.Views(babyTurtles, accessLabel);
|
|
774
775
|
const blockNotes = this.getNotes(pcx.tags());
|
|
775
|
-
|
|
776
|
+
(0, noteable_1.extendOwnAnnotation)(queryDefs, { blockNotes });
|
|
776
777
|
return queryDefs;
|
|
777
778
|
}
|
|
778
779
|
visitDefExplorePrimaryKey(pcx) {
|
|
@@ -844,17 +845,17 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
844
845
|
}
|
|
845
846
|
visitAggregateStatement(pcx) {
|
|
846
847
|
const agStmt = new ast.Aggregate(this.getQueryItems(pcx.queryFieldList(), ast.AggregateFieldDeclaration, ast.AggregateFieldReference));
|
|
847
|
-
|
|
848
|
+
(0, noteable_1.extendOwnAnnotation)(agStmt, { blockNotes: this.getNotes(pcx.tags()) });
|
|
848
849
|
return agStmt;
|
|
849
850
|
}
|
|
850
851
|
visitGroupByStatement(pcx) {
|
|
851
852
|
const groupBy = new ast.GroupBy(this.getQueryItems(pcx.queryFieldList(), ast.GroupByFieldDeclaration, ast.GroupByFieldReference));
|
|
852
|
-
|
|
853
|
+
(0, noteable_1.extendOwnAnnotation)(groupBy, { blockNotes: this.getNotes(pcx.tags()) });
|
|
853
854
|
return groupBy;
|
|
854
855
|
}
|
|
855
856
|
visitCalculateStatement(pcx) {
|
|
856
857
|
const stmt = new ast.Calculate(this.getQueryItems(pcx.queryFieldList(), ast.CalculateFieldDeclaration, ast.CalculateFieldReference));
|
|
857
|
-
|
|
858
|
+
(0, noteable_1.extendOwnAnnotation)(stmt, { blockNotes: this.getNotes(pcx.tags()) });
|
|
858
859
|
return stmt;
|
|
859
860
|
}
|
|
860
861
|
getTaggedRef(pcx, makeFieldDef, makeFieldRef) {
|
|
@@ -879,11 +880,11 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
879
880
|
}
|
|
880
881
|
}
|
|
881
882
|
const def = new makeFieldDef(expr, ref.outputName);
|
|
882
|
-
|
|
883
|
+
(0, noteable_1.extendOwnAnnotation)(def, { notes: this.getNotes(pcx.tags()) });
|
|
883
884
|
return def;
|
|
884
885
|
}
|
|
885
886
|
const ref = this.getFieldPath(pcx.fieldPath(), makeFieldRef);
|
|
886
|
-
|
|
887
|
+
(0, noteable_1.extendOwnAnnotation)(ref, { notes: this.getNotes(pcx.tags()) });
|
|
887
888
|
return ref;
|
|
888
889
|
}
|
|
889
890
|
getFieldCollectionMember(pcx, makeFieldDef, makeFieldRef) {
|
|
@@ -910,7 +911,7 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
910
911
|
}
|
|
911
912
|
visitProjectStatement(pcx) {
|
|
912
913
|
const stmt = this.visitFieldCollection(pcx.fieldCollection());
|
|
913
|
-
|
|
914
|
+
(0, noteable_1.extendOwnAnnotation)(stmt, { blockNotes: this.getNotes(pcx.tags()) });
|
|
914
915
|
return stmt;
|
|
915
916
|
}
|
|
916
917
|
visitCollectionWildCard(pcx) {
|
|
@@ -1021,7 +1022,7 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
1021
1022
|
.map(cx => this.visitTopLevelQueryDef(cx));
|
|
1022
1023
|
const blockNotes = this.getNotes(pcx.tags());
|
|
1023
1024
|
const queryDefs = new ast.DefineQueryList(stmts);
|
|
1024
|
-
|
|
1025
|
+
(0, noteable_1.extendOwnAnnotation)(queryDefs, { blockNotes });
|
|
1025
1026
|
return queryDefs;
|
|
1026
1027
|
}
|
|
1027
1028
|
visitTopLevelQueryDef(pcx) {
|
|
@@ -1030,7 +1031,7 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
1030
1031
|
const notes = this.getNotes(pcx.tags()).concat(this.getIsNotes(pcx.isDefine()));
|
|
1031
1032
|
if (queryExpr instanceof ast.SourceQueryElement) {
|
|
1032
1033
|
const queryDef = new ast.DefineQuery(queryName, queryExpr);
|
|
1033
|
-
|
|
1034
|
+
(0, noteable_1.extendOwnAnnotation)(queryDef, { notes });
|
|
1034
1035
|
return this.astAt(queryDef, pcx);
|
|
1035
1036
|
}
|
|
1036
1037
|
throw this.internalError(pcx, `Expected query definition, got a '${queryExpr.elementType}'`);
|
|
@@ -1041,12 +1042,12 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
1041
1042
|
const theQuery = this.astAt(new ast.AnonymousQuery(query), defCx);
|
|
1042
1043
|
const notes = this.getNotes(pcx.topLevelAnonQueryDef().tags());
|
|
1043
1044
|
const blockNotes = this.getNotes(pcx.tags());
|
|
1044
|
-
|
|
1045
|
+
(0, noteable_1.extendOwnAnnotation)(theQuery, { notes, blockNotes });
|
|
1045
1046
|
return this.astAt(theQuery, pcx);
|
|
1046
1047
|
}
|
|
1047
1048
|
visitNestStatement(pcx) {
|
|
1048
1049
|
const nests = this.visitNestedQueryList(pcx.nestedQueryList());
|
|
1049
|
-
|
|
1050
|
+
(0, noteable_1.extendOwnAnnotation)(nests, { blockNotes: this.getNotes(pcx.tags()) });
|
|
1050
1051
|
return nests;
|
|
1051
1052
|
}
|
|
1052
1053
|
visitNestedQueryList(pcx) {
|
|
@@ -1068,7 +1069,7 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
1068
1069
|
}
|
|
1069
1070
|
const nestDef = new ast.NestFieldDeclaration(name, vExpr);
|
|
1070
1071
|
const isDefineCx = pcx.isDefine();
|
|
1071
|
-
|
|
1072
|
+
(0, noteable_1.extendOwnAnnotation)(nestDef, {
|
|
1072
1073
|
notes: this.getNotes(pcx.tags()).concat(isDefineCx ? this.getIsNotes(isDefineCx) : []),
|
|
1073
1074
|
});
|
|
1074
1075
|
return this.astAt(nestDef, pcx);
|
|
@@ -1077,7 +1078,7 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
1077
1078
|
const name = (0, parse_utils_1.getId)(pcx.exploreQueryNameDef());
|
|
1078
1079
|
const queryDef = new ast.ViewFieldDeclaration(name, this.getVExpr(pcx.vExpr()));
|
|
1079
1080
|
const notes = this.getNotes(pcx.tags()).concat(this.getIsNotes(pcx.isDefine()));
|
|
1080
|
-
|
|
1081
|
+
(0, noteable_1.extendOwnAnnotation)(queryDef, { notes });
|
|
1081
1082
|
return this.astAt(queryDef, pcx);
|
|
1082
1083
|
}
|
|
1083
1084
|
visitExprNot(pcx) {
|
|
@@ -1678,7 +1679,7 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
1678
1679
|
const kind = this.getAccessLabelProp(pcx.accessLabelProp());
|
|
1679
1680
|
const fieldList = this.getIncludeList(listCx);
|
|
1680
1681
|
const item = this.astAt(new ast.IncludeAccessItem(kind, fieldList), pcx);
|
|
1681
|
-
|
|
1682
|
+
(0, noteable_1.extendOwnAnnotation)(item, { blockNotes });
|
|
1682
1683
|
return item;
|
|
1683
1684
|
}
|
|
1684
1685
|
}
|
|
@@ -1724,7 +1725,7 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
|
1724
1725
|
throw this.internalError(pcx, 'Expected a field name or wildcard');
|
|
1725
1726
|
}
|
|
1726
1727
|
const item = this.astAt(new ast.IncludeListItem(reference, as === null || as === void 0 ? void 0 : as.refString), pcx);
|
|
1727
|
-
|
|
1728
|
+
(0, noteable_1.extendOwnAnnotation)(item, { notes });
|
|
1728
1729
|
return item;
|
|
1729
1730
|
}
|
|
1730
1731
|
visitSQParens(pcx) {
|
|
@@ -31,11 +31,25 @@ function unlike(disLiked, x) {
|
|
|
31
31
|
* defined in this slightly weird way. At some point the code here for
|
|
32
32
|
* XXXXFilterCompiler.compile() will move to XXXFilterExpression.compile()
|
|
33
33
|
*/
|
|
34
|
+
// The `none` filter ("always false") compiles to a constant, independent of
|
|
35
|
+
// column type or value; `not none` is "always true". Shared by the top-level
|
|
36
|
+
// guard and every per-type compiler so the constant lives in one place.
|
|
37
|
+
function noneToSQL(not) {
|
|
38
|
+
return not ? 'true' : 'false';
|
|
39
|
+
}
|
|
34
40
|
exports.FilterCompilers = {
|
|
35
41
|
compile(t, c, x, d, qi = {}) {
|
|
36
42
|
if (c === null) {
|
|
37
43
|
return 'true';
|
|
38
44
|
}
|
|
45
|
+
// `none` is the always-false filter (companion to the empty/`null` filter,
|
|
46
|
+
// which is always-true above). It compiles to a constant independent of
|
|
47
|
+
// column type/value, so it is handled here before type dispatch — this is
|
|
48
|
+
// also the primary path for boolean, whose compiler has no switch and
|
|
49
|
+
// would otherwise route `none` through the null/false truth-table.
|
|
50
|
+
if (c.operator === 'none') {
|
|
51
|
+
return noneToSQL(c.not);
|
|
52
|
+
}
|
|
39
53
|
if (t === 'string' && (0, malloy_filter_1.isStringFilter)(c)) {
|
|
40
54
|
return exports.FilterCompilers.stringCompile(c, x, d);
|
|
41
55
|
}
|
|
@@ -87,6 +101,8 @@ exports.FilterCompilers = {
|
|
|
87
101
|
}
|
|
88
102
|
case 'null':
|
|
89
103
|
return nc.not ? `${x} IS NOT NULL` : `${x} IS NULL`;
|
|
104
|
+
case 'none':
|
|
105
|
+
return noneToSQL(nc.not);
|
|
90
106
|
case '()': {
|
|
91
107
|
const wrapped = '(' + exports.FilterCompilers.numberCompile(nc.expr, x, d) + ')';
|
|
92
108
|
return nc.not ? `NOT ${wrapped}` : wrapped;
|
|
@@ -115,7 +131,13 @@ exports.FilterCompilers = {
|
|
|
115
131
|
* =false | F | T | NULL
|
|
116
132
|
* not =false | T | F | NULL
|
|
117
133
|
*/
|
|
118
|
-
if (bc.operator === '
|
|
134
|
+
if (bc.operator === 'none') {
|
|
135
|
+
// Normally intercepted by compile()'s top-level guard; handled here too so
|
|
136
|
+
// booleanCompile is self-safe (this if-chain has no default, and `none`
|
|
137
|
+
// must not fall through to the null/false truth-table below).
|
|
138
|
+
return noneToSQL(bc.not);
|
|
139
|
+
}
|
|
140
|
+
else if (bc.operator === '=true') {
|
|
119
141
|
return bc.not ? `NOT ${px}` : x;
|
|
120
142
|
}
|
|
121
143
|
else if (bc.operator === '=false') {
|
|
@@ -149,6 +171,8 @@ exports.FilterCompilers = {
|
|
|
149
171
|
switch (sc.operator) {
|
|
150
172
|
case 'null':
|
|
151
173
|
return sc.not ? `${x} IS NOT NULL` : `${x} IS NULL`;
|
|
174
|
+
case 'none':
|
|
175
|
+
return noneToSQL(sc.not);
|
|
152
176
|
case 'empty':
|
|
153
177
|
return sc.not ? `COALESCE(${x},'') != ''` : `COALESCE(${x},'') = ''`;
|
|
154
178
|
case '=': {
|
|
@@ -396,6 +420,8 @@ class TemporalFilterCompiler {
|
|
|
396
420
|
}
|
|
397
421
|
case 'null':
|
|
398
422
|
return tc.not ? `${x} IS NOT NULL` : `${x} IS NULL`;
|
|
423
|
+
case 'none':
|
|
424
|
+
return noneToSQL(tc.not);
|
|
399
425
|
case '()': {
|
|
400
426
|
const wrapped = '(' + this.compile(tc.expr) + ')';
|
|
401
427
|
return tc.not ? `NOT ${wrapped}` : wrapped;
|
|
@@ -330,9 +330,9 @@ export type Argument = Parameter;
|
|
|
330
330
|
* Type of a given declaration. The grammar's `malloyType` already excludes
|
|
331
331
|
* `json` and `sql native`, so any value of this union is a legal given type.
|
|
332
332
|
*
|
|
333
|
-
* The fully-narrowed recursive form
|
|
334
|
-
*
|
|
335
|
-
*
|
|
333
|
+
* The fully-narrowed recursive form (a fresh union over a smaller atomic
|
|
334
|
+
* base) lands with the IR work; the shape here is the conservative
|
|
335
|
+
* "not yet narrowed" version.
|
|
336
336
|
*/
|
|
337
337
|
export type GivenTypeDef = AtomicTypeDef | FilterExpressionParamTypeDef;
|
|
338
338
|
export interface Given extends HasLocation, HasAnnotations {
|
|
@@ -110,7 +110,7 @@ export declare class QueryQuery extends QueryField {
|
|
|
110
110
|
* falls back to the general demux path, which is correct for every case.
|
|
111
111
|
*/
|
|
112
112
|
canUseSingleGroupSetSQL(): boolean;
|
|
113
|
-
generatePipelinedStages(outputPipelinedSQL: OutputPipelinedSQL[], lastStageName: string, stageWriter: StageWriter, priorStageColumns: StageOutputColumn[]): string;
|
|
113
|
+
generatePipelinedStages(outputPipelinedSQL: OutputPipelinedSQL[], lastStageName: string, stageWriter: StageWriter, priorStageColumns: StageOutputColumn[], finalStageOrderBy?: string): string;
|
|
114
114
|
generateStage0Fields(resultSet: FieldInstanceResult, output: StageOutputContext, stageWriter: StageWriter): void;
|
|
115
115
|
generateSQLWhereChildren(resultStruct: FieldInstanceResult): AndChain;
|
|
116
116
|
generateSQLWhereTurtled(): string;
|
|
@@ -1013,7 +1013,7 @@ class QueryQuery extends query_node_1.QueryField {
|
|
|
1013
1013
|
// everything else is carried through unchanged by its emitted name -- for a
|
|
1014
1014
|
// grouped stage that is the group-set-suffixed form (e.g. `f1__0`), not the
|
|
1015
1015
|
// final output name.
|
|
1016
|
-
priorStageColumns) {
|
|
1016
|
+
priorStageColumns, finalStageOrderBy = '') {
|
|
1017
1017
|
if (outputPipelinedSQL.length === 0) {
|
|
1018
1018
|
return lastStageName;
|
|
1019
1019
|
}
|
|
@@ -1031,6 +1031,9 @@ class QueryQuery extends query_node_1.QueryField {
|
|
|
1031
1031
|
.map(c => c.name)
|
|
1032
1032
|
.filter(name => outputFields.indexOf(name) === -1);
|
|
1033
1033
|
retSQL = `SELECT ${fields.length > 0 ? fields.join(', ') + ',' : ''} ${pipelinesSQL} FROM ${lastStageName}`;
|
|
1034
|
+
if (finalStageOrderBy.length > 0) {
|
|
1035
|
+
retSQL += `\n${finalStageOrderBy}`;
|
|
1036
|
+
}
|
|
1034
1037
|
}
|
|
1035
1038
|
return stageWriter.addStage(retSQL);
|
|
1036
1039
|
}
|
|
@@ -1503,13 +1506,14 @@ class QueryQuery extends query_node_1.QueryField {
|
|
|
1503
1506
|
s += `GROUP BY ${dimensionPositions.join(',')}\n`;
|
|
1504
1507
|
}
|
|
1505
1508
|
// order by
|
|
1506
|
-
|
|
1509
|
+
const orderBySQL = this.genereateSQLOrderBy(this.firstSegment, this.rootResult);
|
|
1510
|
+
s += orderBySQL;
|
|
1507
1511
|
// limit
|
|
1508
1512
|
if (!(0, malloy_types_1.isRawSegment)(this.firstSegment) && this.firstSegment.limit) {
|
|
1509
1513
|
s += `LIMIT ${this.firstSegment.limit}\n`;
|
|
1510
1514
|
}
|
|
1511
1515
|
this.resultStage = stageWriter.addStage(s);
|
|
1512
|
-
this.resultStage = this.generatePipelinedStages(outputPipelinedSQL, this.resultStage, stageWriter, columns);
|
|
1516
|
+
this.resultStage = this.generatePipelinedStages(outputPipelinedSQL, this.resultStage, stageWriter, columns, orderBySQL);
|
|
1513
1517
|
return this.resultStage;
|
|
1514
1518
|
}
|
|
1515
1519
|
// create a simplified version of the StructDef for dialects.
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const MALLOY_VERSION = "0.0.
|
|
1
|
+
export declare const MALLOY_VERSION = "0.0.423";
|
package/dist/version.js
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MALLOY_VERSION = void 0;
|
|
4
4
|
// generated with 'generate-version-file' script; do not edit manually
|
|
5
|
-
exports.MALLOY_VERSION = '0.0.
|
|
5
|
+
exports.MALLOY_VERSION = '0.0.423';
|
|
6
6
|
//# sourceMappingURL=version.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@malloydata/malloy",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.423",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dist/index.js",
|
|
@@ -51,9 +51,9 @@
|
|
|
51
51
|
"generate-version-file": "VERSION=$(npm pkg get version --workspaces=false | tr -d \\\")\necho \"// generated with 'generate-version-file' script; do not edit manually\\nexport const MALLOY_VERSION = '$VERSION';\" > src/version.ts"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@malloydata/malloy-filter": "0.0.
|
|
55
|
-
"@malloydata/malloy-interfaces": "0.0.
|
|
56
|
-
"@malloydata/malloy-tag": "0.0.
|
|
54
|
+
"@malloydata/malloy-filter": "0.0.423",
|
|
55
|
+
"@malloydata/malloy-interfaces": "0.0.423",
|
|
56
|
+
"@malloydata/malloy-tag": "0.0.423",
|
|
57
57
|
"@noble/hashes": "^1.8.0",
|
|
58
58
|
"antlr4ts": "^0.5.0-alpha.4",
|
|
59
59
|
"assert": "^2.0.0",
|