@malloydata/malloy 0.0.261-dev250410224545 → 0.0.261-dev250411181206
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.
|
@@ -68,8 +68,9 @@ export declare class MalloyToQuery extends AbstractParseTreeVisitor<Node> implem
|
|
|
68
68
|
getFieldExpression(cx: parse.FieldExprContext): Malloy.Expression | null;
|
|
69
69
|
stripQuote(s: string, q: string): string;
|
|
70
70
|
getFilterString(cx: parse.FilterStringContext): string | null;
|
|
71
|
-
|
|
72
|
-
getWhere(whereCx: parse.WhereStatementContext): Malloy.
|
|
71
|
+
getFilterExpr(cx: parse.FieldExprContext): Malloy.FilterOperation | null;
|
|
72
|
+
getWhere(whereCx: parse.WhereStatementContext): Malloy.FilterOperation[] | null;
|
|
73
|
+
getHaving(havingCx: parse.HavingStatementContext): Malloy.FilterOperation[] | null;
|
|
73
74
|
protected combineAnnotations(...a: (Malloy.Annotation[] | undefined)[]): Malloy.Annotation[] | undefined;
|
|
74
75
|
}
|
|
75
76
|
export declare function malloyToQuery(code: string): {
|
|
@@ -466,7 +466,14 @@ class MalloyToQuery extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor
|
|
|
466
466
|
}));
|
|
467
467
|
}
|
|
468
468
|
else if (cx.havingStatement()) {
|
|
469
|
-
|
|
469
|
+
const hvcx = cx.havingStatement();
|
|
470
|
+
const having = this.getHaving(hvcx);
|
|
471
|
+
if (having === null)
|
|
472
|
+
return null;
|
|
473
|
+
return having.map(h => ({
|
|
474
|
+
kind: 'having',
|
|
475
|
+
...h,
|
|
476
|
+
}));
|
|
470
477
|
}
|
|
471
478
|
else if (cx.nestStatement()) {
|
|
472
479
|
const obcx = cx.nestStatement();
|
|
@@ -662,7 +669,7 @@ class MalloyToQuery extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor
|
|
|
662
669
|
}
|
|
663
670
|
return null;
|
|
664
671
|
}
|
|
665
|
-
|
|
672
|
+
getFilterExpr(cx) {
|
|
666
673
|
if (cx instanceof parse.ExprCompareContext) {
|
|
667
674
|
if (cx.compareOp().MATCH()) {
|
|
668
675
|
const lhs = cx.fieldExpr()[0];
|
|
@@ -694,12 +701,20 @@ class MalloyToQuery extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor
|
|
|
694
701
|
}
|
|
695
702
|
getWhere(whereCx) {
|
|
696
703
|
const exprs = whereCx.filterClauseList().fieldExpr();
|
|
697
|
-
const where = exprs.map(exprCx => this.
|
|
704
|
+
const where = exprs.map(exprCx => this.getFilterExpr(exprCx));
|
|
698
705
|
if (where.some(w => w === null)) {
|
|
699
706
|
return null;
|
|
700
707
|
}
|
|
701
708
|
return where;
|
|
702
709
|
}
|
|
710
|
+
getHaving(havingCx) {
|
|
711
|
+
const exprs = havingCx.filterClauseList().fieldExpr();
|
|
712
|
+
const having = exprs.map(exprCx => this.getFilterExpr(exprCx));
|
|
713
|
+
if (having.some(h => h === null)) {
|
|
714
|
+
return null;
|
|
715
|
+
}
|
|
716
|
+
return having;
|
|
717
|
+
}
|
|
703
718
|
combineAnnotations(...a) {
|
|
704
719
|
const annotations = a.flatMap(a => a !== null && a !== void 0 ? a : []);
|
|
705
720
|
return annotations.length > 0 ? annotations : undefined;
|
|
@@ -2842,11 +2842,12 @@ class QueryQuery extends QueryField {
|
|
|
2842
2842
|
this.prepare(stageWriter);
|
|
2843
2843
|
let lastStageName = this.generateSQL(stageWriter);
|
|
2844
2844
|
let outputStruct = this.getResultStructDef();
|
|
2845
|
-
|
|
2845
|
+
const pipeline = [...this.fieldDef.pipeline];
|
|
2846
|
+
if (pipeline.length > 1) {
|
|
2846
2847
|
// console.log(pretty(outputStruct));
|
|
2847
|
-
const pipeline = [...this.fieldDef.pipeline];
|
|
2848
2848
|
let structDef = {
|
|
2849
2849
|
...outputStruct,
|
|
2850
|
+
name: lastStageName,
|
|
2850
2851
|
type: 'finalize',
|
|
2851
2852
|
};
|
|
2852
2853
|
pipeline.shift();
|
|
@@ -2861,6 +2862,7 @@ class QueryQuery extends QueryField {
|
|
|
2861
2862
|
outputStruct = q.getResultStructDef();
|
|
2862
2863
|
structDef = {
|
|
2863
2864
|
...outputStruct,
|
|
2865
|
+
name: lastStageName,
|
|
2864
2866
|
type: 'finalize',
|
|
2865
2867
|
};
|
|
2866
2868
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@malloydata/malloy",
|
|
3
|
-
"version": "0.0.261-
|
|
3
|
+
"version": "0.0.261-dev250411181206",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dist/index.js",
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
"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"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@malloydata/malloy-filter": "^0.0.261-
|
|
45
|
-
"@malloydata/malloy-interfaces": "^0.0.261-
|
|
46
|
-
"@malloydata/malloy-tag": "^0.0.261-
|
|
44
|
+
"@malloydata/malloy-filter": "^0.0.261-dev250411181206",
|
|
45
|
+
"@malloydata/malloy-interfaces": "^0.0.261-dev250411181206",
|
|
46
|
+
"@malloydata/malloy-tag": "^0.0.261-dev250411181206",
|
|
47
47
|
"antlr4ts": "^0.5.0-alpha.4",
|
|
48
48
|
"assert": "^2.0.0",
|
|
49
49
|
"jaro-winkler": "^0.2.8",
|