@malloydata/malloy 0.0.22-dev230207182613 → 0.0.22-dev230207183024
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_utils.js +7 -7
- package/dist/dialect/dialect.d.ts +1 -1
- package/dist/dialect/duckdb.d.ts +1 -1
- package/dist/dialect/duckdb.js +9 -9
- package/dist/dialect/postgres.d.ts +1 -1
- package/dist/dialect/postgres.js +16 -16
- package/dist/dialect/standardsql.d.ts +1 -1
- package/dist/dialect/standardsql.js +8 -8
- package/dist/index.d.ts +6 -6
- package/dist/lang/ast/ast-utils.js +3 -3
- package/dist/lang/ast/elements/define-query.js +4 -4
- package/dist/lang/ast/elements/define-source.d.ts +1 -1
- package/dist/lang/ast/elements/define-source.js +8 -8
- package/dist/lang/ast/elements/import-statement.js +2 -2
- package/dist/lang/ast/elements/pipeline-desc.d.ts +1 -1
- package/dist/lang/ast/elements/pipeline-desc.js +7 -7
- package/dist/lang/ast/elements/refined-source.d.ts +1 -1
- package/dist/lang/ast/elements/refined-source.js +5 -5
- package/dist/lang/ast/elements/source.js +1 -1
- package/dist/lang/ast/error-factory.js +16 -13
- package/dist/lang/ast/expressions/binary-boolean.d.ts +1 -1
- package/dist/lang/ast/expressions/binary-boolean.js +4 -4
- package/dist/lang/ast/expressions/binary-numeric.d.ts +1 -1
- package/dist/lang/ast/expressions/binary-numeric.js +1 -1
- package/dist/lang/ast/expressions/boolean.js +1 -1
- package/dist/lang/ast/expressions/constant-sub-expression.js +7 -7
- package/dist/lang/ast/expressions/expr-aggregate-function.d.ts +3 -3
- package/dist/lang/ast/expressions/expr-aggregate-function.js +12 -12
- package/dist/lang/ast/expressions/expr-alternation-tree.js +3 -3
- package/dist/lang/ast/expressions/expr-asymmetric.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-asymmetric.js +1 -1
- package/dist/lang/ast/expressions/expr-avg.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-avg.js +1 -1
- package/dist/lang/ast/expressions/expr-cast.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-cast.js +26 -4
- package/dist/lang/ast/expressions/expr-compare.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-compare.js +3 -3
- package/dist/lang/ast/expressions/expr-count.js +6 -6
- package/dist/lang/ast/expressions/expr-filter.d.ts +2 -2
- package/dist/lang/ast/expressions/expr-filter.js +8 -8
- package/dist/lang/ast/expressions/expr-func.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-func.js +3 -3
- package/dist/lang/ast/expressions/expr-granular-time.js +7 -7
- package/dist/lang/ast/expressions/expr-id-reference.js +11 -11
- package/dist/lang/ast/expressions/expr-logical-op.js +1 -1
- package/dist/lang/ast/expressions/expr-minus.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-minus.js +3 -3
- package/dist/lang/ast/expressions/expr-not.js +2 -2
- package/dist/lang/ast/expressions/expr-now.js +7 -7
- package/dist/lang/ast/expressions/expr-null.js +3 -3
- package/dist/lang/ast/expressions/expr-number.js +1 -1
- package/dist/lang/ast/expressions/expr-parens.js +2 -2
- package/dist/lang/ast/expressions/expr-regex.js +3 -3
- package/dist/lang/ast/expressions/expr-string.js +6 -6
- package/dist/lang/ast/expressions/expr-sum.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-sum.js +1 -1
- package/dist/lang/ast/expressions/expr-time-extract.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-time-extract.js +29 -29
- package/dist/lang/ast/expressions/expr-time.js +7 -7
- package/dist/lang/ast/expressions/expr-ungroup.d.ts +2 -2
- package/dist/lang/ast/expressions/expr-ungroup.js +11 -8
- package/dist/lang/ast/expressions/for-range.d.ts +1 -1
- package/dist/lang/ast/expressions/for-range.js +1 -1
- package/dist/lang/ast/expressions/granular-literal.js +12 -12
- package/dist/lang/ast/expressions/partial-compare.d.ts +1 -1
- package/dist/lang/ast/expressions/partial-compare.js +1 -1
- package/dist/lang/ast/expressions/pick-when.d.ts +1 -1
- package/dist/lang/ast/expressions/pick-when.js +11 -11
- package/dist/lang/ast/expressions/range.js +4 -4
- package/dist/lang/ast/expressions/top-by.d.ts +1 -1
- package/dist/lang/ast/expressions/top-by.js +4 -4
- package/dist/lang/ast/expressions/unary.js +1 -1
- package/dist/lang/ast/field-space/dynamic-space.d.ts +1 -1
- package/dist/lang/ast/field-space/dynamic-space.js +1 -1
- package/dist/lang/ast/field-space/index-field-space.js +2 -2
- package/dist/lang/ast/field-space/query-field-struct.js +1 -1
- package/dist/lang/ast/field-space/query-space-field.js +1 -1
- package/dist/lang/ast/field-space/query-spaces.js +2 -2
- package/dist/lang/ast/field-space/reference-field.js +1 -1
- package/dist/lang/ast/field-space/rename-space-field.js +2 -2
- package/dist/lang/ast/field-space/static-space.js +8 -8
- package/dist/lang/ast/field-space/struct-space-field-base.js +1 -1
- package/dist/lang/ast/fragtype-utils.js +2 -2
- package/dist/lang/ast/parameters/constant-parameter.js +9 -9
- package/dist/lang/ast/parameters/has-parameter.js +5 -5
- package/dist/lang/ast/query-elements/anonymous-query.js +1 -1
- package/dist/lang/ast/query-elements/existing-query.d.ts +1 -1
- package/dist/lang/ast/query-elements/existing-query.js +11 -11
- package/dist/lang/ast/query-elements/full-query.js +11 -11
- package/dist/lang/ast/query-elements/query-head-struct.js +1 -1
- package/dist/lang/ast/query-items/field-declaration.d.ts +1 -1
- package/dist/lang/ast/query-items/field-declaration.js +11 -11
- package/dist/lang/ast/query-items/field-references.d.ts +1 -1
- package/dist/lang/ast/query-items/field-references.js +1 -1
- package/dist/lang/ast/query-properties/filters.d.ts +1 -1
- package/dist/lang/ast/query-properties/filters.js +7 -7
- package/dist/lang/ast/query-properties/indexing.d.ts +1 -1
- package/dist/lang/ast/query-properties/indexing.js +2 -2
- package/dist/lang/ast/query-properties/joins.d.ts +1 -1
- package/dist/lang/ast/query-properties/joins.js +17 -14
- package/dist/lang/ast/query-properties/nest.js +4 -4
- package/dist/lang/ast/query-properties/ordering.js +2 -2
- package/dist/lang/ast/query-properties/qop-desc.js +1 -1
- package/dist/lang/ast/query-properties/top.js +3 -3
- package/dist/lang/ast/source-properties/field-list-edit.js +1 -1
- package/dist/lang/ast/source-properties/primary-key.js +1 -1
- package/dist/lang/ast/source-properties/renames.js +1 -1
- package/dist/lang/ast/sources/named-source.d.ts +2 -2
- package/dist/lang/ast/sources/named-source.js +6 -6
- package/dist/lang/ast/sources/query-source.d.ts +1 -1
- package/dist/lang/ast/sources/query-source.js +2 -2
- package/dist/lang/ast/sources/table-source.js +7 -5
- package/dist/lang/ast/space-seed.d.ts +1 -1
- package/dist/lang/ast/sql-elements/sql-statement.js +5 -5
- package/dist/lang/ast/sql-elements/sql-string.js +1 -1
- package/dist/lang/ast/struct-utils.js +2 -2
- package/dist/lang/ast/time-utils.js +32 -32
- package/dist/lang/ast/types/expression-def.js +34 -34
- package/dist/lang/ast/types/malloy-element.d.ts +4 -4
- package/dist/lang/ast/types/malloy-element.js +27 -27
- package/dist/lang/ast/types/query-comp.d.ts +1 -1
- package/dist/lang/ast/types/space-field.js +1 -1
- package/dist/lang/ast/types/space-param.js +2 -2
- package/dist/lang/ast/types/turtle-headed-pipe.d.ts +1 -1
- package/dist/lang/ast/types/turtle-headed-pipe.js +1 -1
- package/dist/lang/ast/types/type-desc.d.ts +1 -1
- package/dist/lang/field-utils.d.ts +1 -1
- package/dist/lang/index.d.ts +1 -1
- package/dist/lang/malloy-to-ast.d.ts +1 -1
- package/dist/lang/malloy-to-ast.js +11 -11
- package/dist/lang/parse-error-handler.js +4 -4
- package/dist/lang/parse-malloy.d.ts +4 -4
- package/dist/lang/parse-malloy.js +61 -61
- package/dist/lang/parse-tree-walkers/document-completion-walker.js +16 -16
- package/dist/lang/parse-tree-walkers/document-help-context-walker.js +10 -10
- package/dist/lang/parse-tree-walkers/document-highlight-walker.js +85 -82
- package/dist/lang/parse-tree-walkers/document-symbol-walker.js +40 -40
- package/dist/lang/parse-tree-walkers/find-external-references.d.ts +1 -1
- package/dist/lang/parse-tree-walkers/find-external-references.js +2 -2
- package/dist/lang/reference-list.d.ts +1 -1
- package/dist/lang/test/document-help-context-walker.spec.js +6 -6
- package/dist/lang/test/document-symbol-walker.spec.js +3 -3
- package/dist/lang/test/field-symbols.spec.js +62 -58
- package/dist/lang/test/parse.spec.js +262 -260
- package/dist/lang/test/test-translator.d.ts +1 -1
- package/dist/lang/test/test-translator.js +139 -139
- package/dist/lang/translate-response.d.ts +1 -1
- package/dist/lang/zone.js +5 -5
- package/dist/malloy.d.ts +5 -5
- package/dist/malloy.js +72 -72
- package/dist/model/malloy_query.d.ts +2 -2
- package/dist/model/malloy_query.js +179 -176
- package/dist/model/malloy_types.js +41 -41
- package/dist/model/sql_block.js +2 -2
- package/package.json +1 -1
|
@@ -25,8 +25,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
25
25
|
exports.ExprAggregateFunction = void 0;
|
|
26
26
|
const malloy_types_1 = require("../../../model/malloy_types");
|
|
27
27
|
const ast_utils_1 = require("../ast-utils");
|
|
28
|
-
const fragtype_utils_1 = require("../fragtype-utils");
|
|
29
28
|
const struct_space_field_base_1 = require("../field-space/struct-space-field-base");
|
|
29
|
+
const fragtype_utils_1 = require("../fragtype-utils");
|
|
30
30
|
const expression_def_1 = require("../types/expression-def");
|
|
31
31
|
class ExprAggregateFunction extends expression_def_1.ExpressionDef {
|
|
32
32
|
constructor(func, expr) {
|
|
@@ -36,7 +36,7 @@ class ExprAggregateFunction extends expression_def_1.ExpressionDef {
|
|
|
36
36
|
this.elementType = func;
|
|
37
37
|
if (expr) {
|
|
38
38
|
this.expr = expr;
|
|
39
|
-
this.has({ expr });
|
|
39
|
+
this.has({ "expr": expr });
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
returns(_forExpression) {
|
|
@@ -52,9 +52,9 @@ class ExprAggregateFunction extends expression_def_1.ExpressionDef {
|
|
|
52
52
|
const footType = sourceFoot.typeDesc();
|
|
53
53
|
if ((0, malloy_types_1.isAtomicFieldType)(footType.dataType)) {
|
|
54
54
|
exprVal = {
|
|
55
|
-
dataType: footType.dataType,
|
|
56
|
-
expressionType: footType.expressionType,
|
|
57
|
-
value: [{ type: "field", path: this.source.refString }]
|
|
55
|
+
"dataType": footType.dataType,
|
|
56
|
+
"expressionType": footType.expressionType,
|
|
57
|
+
"value": [{ "type": "field", "path": this.source.refString }]
|
|
58
58
|
};
|
|
59
59
|
structPath = this.source.sourceString;
|
|
60
60
|
}
|
|
@@ -76,20 +76,20 @@ class ExprAggregateFunction extends expression_def_1.ExpressionDef {
|
|
|
76
76
|
}
|
|
77
77
|
if (this.typeCheck(this.expr || this, {
|
|
78
78
|
...exprVal,
|
|
79
|
-
expressionType: "scalar"
|
|
79
|
+
"expressionType": "scalar"
|
|
80
80
|
})) {
|
|
81
81
|
const f = {
|
|
82
|
-
type: "aggregate",
|
|
83
|
-
function: this.func,
|
|
84
|
-
e: exprVal.value
|
|
82
|
+
"type": "aggregate",
|
|
83
|
+
"function": this.func,
|
|
84
|
+
"e": exprVal.value
|
|
85
85
|
};
|
|
86
86
|
if (structPath) {
|
|
87
87
|
f.structPath = structPath;
|
|
88
88
|
}
|
|
89
89
|
return {
|
|
90
|
-
dataType: this.returns(exprVal),
|
|
91
|
-
expressionType: "aggregate",
|
|
92
|
-
value: [f]
|
|
90
|
+
"dataType": this.returns(exprVal),
|
|
91
|
+
"expressionType": "aggregate",
|
|
92
|
+
"value": [f]
|
|
93
93
|
};
|
|
94
94
|
}
|
|
95
95
|
return (0, ast_utils_1.errorFor)("aggregate type check");
|
|
@@ -37,9 +37,9 @@ class ExprAlternationTree extends binary_boolean_1.BinaryBoolean {
|
|
|
37
37
|
const choice1 = this.left.apply(fs, applyOp, expr);
|
|
38
38
|
const choice2 = this.right.apply(fs, applyOp, expr);
|
|
39
39
|
return {
|
|
40
|
-
dataType: "boolean",
|
|
41
|
-
expressionType: (0, malloy_types_1.maxExpressionType)(choice1.expressionType, choice2.expressionType),
|
|
42
|
-
value: (0, utils_1.compose)(choice1.value, this.op === "&" ? "and" : "or", choice2.value)
|
|
40
|
+
"dataType": "boolean",
|
|
41
|
+
"expressionType": (0, malloy_types_1.maxExpressionType)(choice1.expressionType, choice2.expressionType),
|
|
42
|
+
"value": (0, utils_1.compose)(choice1.value, this.op === "&" ? "and" : "or", choice2.value)
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
45
|
requestExpression(_fs) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FieldReference } from "../query-items/field-references";
|
|
2
|
-
import { ExprAggregateFunction } from "./expr-aggregate-function";
|
|
3
2
|
import { ExpressionDef } from "../types/expression-def";
|
|
3
|
+
import { ExprAggregateFunction } from "./expr-aggregate-function";
|
|
4
4
|
export declare abstract class ExprAsymmetric extends ExprAggregateFunction {
|
|
5
5
|
readonly func: "sum" | "avg";
|
|
6
6
|
readonly expr: ExpressionDef | undefined;
|
|
@@ -8,7 +8,7 @@ class ExprAsymmetric extends expr_aggregate_function_1.ExprAggregateFunction {
|
|
|
8
8
|
this.func = func;
|
|
9
9
|
this.expr = expr;
|
|
10
10
|
this.source = source;
|
|
11
|
-
this.has({ source });
|
|
11
|
+
this.has({ "source": source });
|
|
12
12
|
}
|
|
13
13
|
defaultFieldName() {
|
|
14
14
|
if (this.source && this.expr === undefined) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ExpressionDef } from "../types/expression-def";
|
|
2
1
|
import { FieldReference } from "../query-items/field-references";
|
|
2
|
+
import { ExpressionDef } from "../types/expression-def";
|
|
3
3
|
import { ExprAsymmetric } from "./expr-asymmetric";
|
|
4
4
|
export declare class ExprAvg extends ExprAsymmetric {
|
|
5
5
|
constructor(expr: ExpressionDef | undefined, source?: FieldReference);
|
|
@@ -27,7 +27,7 @@ const expr_asymmetric_1 = require("./expr-asymmetric");
|
|
|
27
27
|
class ExprAvg extends expr_asymmetric_1.ExprAsymmetric {
|
|
28
28
|
constructor(expr, source) {
|
|
29
29
|
super("avg", expr, source);
|
|
30
|
-
this.has({ source });
|
|
30
|
+
this.has({ "source": source });
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
exports.ExprAvg = ExprAvg;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExprValue } from "../types/expr-value";
|
|
2
|
-
import { FieldSpace } from "../types/field-space";
|
|
3
2
|
import { ExpressionDef } from "../types/expression-def";
|
|
3
|
+
import { FieldSpace } from "../types/field-space";
|
|
4
4
|
export declare type CastType = "string" | "number" | "boolean" | "date" | "timestamp";
|
|
5
5
|
export declare function isCastType(t: string): t is CastType;
|
|
6
6
|
export declare class ExprCast extends ExpressionDef {
|
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ExprCast = exports.isCastType = void 0;
|
|
4
|
+
/*
|
|
5
|
+
* Copyright 2023 Google LLC
|
|
6
|
+
*
|
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
8
|
+
* a copy of this software and associated documentation files
|
|
9
|
+
* (the "Software"), to deal in the Software without restriction,
|
|
10
|
+
* including without limitation the rights to use, copy, modify, merge,
|
|
11
|
+
* publish, distribute, sublicense, and/or sell copies of the Software,
|
|
12
|
+
* and to permit persons to whom the Software is furnished to do so,
|
|
13
|
+
* subject to the following conditions:
|
|
14
|
+
*
|
|
15
|
+
* The above copyright notice and this permission notice shall be
|
|
16
|
+
* included in all copies or substantial portions of the Software.
|
|
17
|
+
*
|
|
18
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
19
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
20
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
21
|
+
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
22
|
+
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
23
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
24
|
+
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
25
|
+
*/
|
|
4
26
|
const time_utils_1 = require("../time-utils");
|
|
5
27
|
const expression_def_1 = require("../types/expression-def");
|
|
6
28
|
const utils_1 = require("./utils");
|
|
@@ -10,7 +32,7 @@ function isCastType(t) {
|
|
|
10
32
|
exports.isCastType = isCastType;
|
|
11
33
|
class ExprCast extends expression_def_1.ExpressionDef {
|
|
12
34
|
constructor(expr, castType, safe = false) {
|
|
13
|
-
super({ expr });
|
|
35
|
+
super({ "expr": expr });
|
|
14
36
|
this.expr = expr;
|
|
15
37
|
this.castType = castType;
|
|
16
38
|
this.safe = safe;
|
|
@@ -19,9 +41,9 @@ class ExprCast extends expression_def_1.ExpressionDef {
|
|
|
19
41
|
getExpression(fs) {
|
|
20
42
|
const expr = this.expr.getExpression(fs);
|
|
21
43
|
return {
|
|
22
|
-
dataType: this.castType,
|
|
23
|
-
expressionType: expr.expressionType,
|
|
24
|
-
value: (0, utils_1.compressExpr)((0, time_utils_1.castTo)(this.castType, expr.value, this.safe))
|
|
44
|
+
"dataType": this.castType,
|
|
45
|
+
"expressionType": expr.expressionType,
|
|
46
|
+
"value": (0, utils_1.compressExpr)((0, time_utils_1.castTo)(this.castType, expr.value, this.safe))
|
|
25
47
|
};
|
|
26
48
|
}
|
|
27
49
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Comparison } from "../types/comparison";
|
|
2
|
-
import { FieldSpace } from "../types/field-space";
|
|
3
2
|
import { ExprValue } from "../types/expr-value";
|
|
4
3
|
import { ExpressionDef } from "../types/expression-def";
|
|
4
|
+
import { FieldSpace } from "../types/field-space";
|
|
5
5
|
import { BinaryBoolean } from "./binary-boolean";
|
|
6
6
|
export declare class ExprCompare extends BinaryBoolean<Comparison> {
|
|
7
7
|
elementType: string;
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
*/
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
exports.ExprCompare = void 0;
|
|
26
|
-
const
|
|
26
|
+
const fragtype_utils_1 = require("../fragtype-utils");
|
|
27
27
|
const granular_result_1 = require("../types/granular-result");
|
|
28
28
|
const binary_boolean_1 = require("./binary-boolean");
|
|
29
|
-
const
|
|
29
|
+
const expr_granular_time_1 = require("./expr-granular-time");
|
|
30
30
|
const compareTypes = {
|
|
31
31
|
"~": [fragtype_utils_1.FT.stringT],
|
|
32
32
|
"!~": [fragtype_utils_1.FT.stringT],
|
|
@@ -35,7 +35,7 @@ const compareTypes = {
|
|
|
35
35
|
"=": [fragtype_utils_1.FT.numberT, fragtype_utils_1.FT.stringT, fragtype_utils_1.FT.dateT, fragtype_utils_1.FT.timestampT],
|
|
36
36
|
"!=": [fragtype_utils_1.FT.numberT, fragtype_utils_1.FT.stringT, fragtype_utils_1.FT.dateT, fragtype_utils_1.FT.timestampT],
|
|
37
37
|
">=": [fragtype_utils_1.FT.numberT, fragtype_utils_1.FT.stringT, fragtype_utils_1.FT.dateT, fragtype_utils_1.FT.timestampT],
|
|
38
|
-
">": [fragtype_utils_1.FT.numberT, fragtype_utils_1.FT.stringT, fragtype_utils_1.FT.dateT, fragtype_utils_1.FT.timestampT]
|
|
38
|
+
">": [fragtype_utils_1.FT.numberT, fragtype_utils_1.FT.stringT, fragtype_utils_1.FT.dateT, fragtype_utils_1.FT.timestampT]
|
|
39
39
|
};
|
|
40
40
|
class ExprCompare extends binary_boolean_1.BinaryBoolean {
|
|
41
41
|
constructor(left, op, right) {
|
|
@@ -39,17 +39,17 @@ class ExprCount extends expr_aggregate_function_1.ExprAggregateFunction {
|
|
|
39
39
|
}
|
|
40
40
|
getExpression(_fs) {
|
|
41
41
|
const ret = {
|
|
42
|
-
type: "aggregate",
|
|
43
|
-
function: "count",
|
|
44
|
-
e: []
|
|
42
|
+
"type": "aggregate",
|
|
43
|
+
"function": "count",
|
|
44
|
+
"e": []
|
|
45
45
|
};
|
|
46
46
|
if (this.source) {
|
|
47
47
|
ret.structPath = this.source.refString;
|
|
48
48
|
}
|
|
49
49
|
return {
|
|
50
|
-
dataType: "number",
|
|
51
|
-
expressionType: "aggregate",
|
|
52
|
-
value: [ret]
|
|
50
|
+
"dataType": "number",
|
|
51
|
+
"expressionType": "aggregate",
|
|
52
|
+
"value": [ret]
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
55
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ExprValue } from "../types/expr-value";
|
|
2
|
-
import { FieldSpace } from "../types/field-space";
|
|
3
1
|
import { Filter } from "../query-properties/filters";
|
|
2
|
+
import { ExprValue } from "../types/expr-value";
|
|
4
3
|
import { ExpressionDef } from "../types/expression-def";
|
|
4
|
+
import { FieldSpace } from "../types/field-space";
|
|
5
5
|
export declare class ExprFilter extends ExpressionDef {
|
|
6
6
|
readonly expr: ExpressionDef;
|
|
7
7
|
readonly filter: Filter;
|
|
@@ -29,7 +29,7 @@ const fragtype_utils_1 = require("../fragtype-utils");
|
|
|
29
29
|
const expression_def_1 = require("../types/expression-def");
|
|
30
30
|
class ExprFilter extends expression_def_1.ExpressionDef {
|
|
31
31
|
constructor(expr, filter) {
|
|
32
|
-
super({ expr, filter });
|
|
32
|
+
super({ "expr": expr, "filter": filter });
|
|
33
33
|
this.expr = expr;
|
|
34
34
|
this.filter = filter;
|
|
35
35
|
this.elementType = "filtered expression";
|
|
@@ -49,16 +49,16 @@ class ExprFilter extends expression_def_1.ExpressionDef {
|
|
|
49
49
|
// idea of warnings, so for now ...
|
|
50
50
|
return resultExpr;
|
|
51
51
|
}
|
|
52
|
-
if (this.typeCheck(this.expr, { ...resultExpr, expressionType: "scalar" })) {
|
|
52
|
+
if (this.typeCheck(this.expr, { ...resultExpr, "expressionType": "scalar" })) {
|
|
53
53
|
return {
|
|
54
54
|
...resultExpr,
|
|
55
|
-
value: [
|
|
55
|
+
"value": [
|
|
56
56
|
{
|
|
57
|
-
type: "filterExpression",
|
|
58
|
-
e: resultExpr.value,
|
|
59
|
-
filterList: testList
|
|
60
|
-
}
|
|
61
|
-
]
|
|
57
|
+
"type": "filterExpression",
|
|
58
|
+
"e": resultExpr.value,
|
|
59
|
+
"filterList": testList
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
64
|
this.expr.log(`Cannot filter '${resultExpr.dataType}' data`);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExprValue } from "../types/expr-value";
|
|
2
|
-
import { FieldSpace } from "../types/field-space";
|
|
3
2
|
import { ExpressionDef } from "../types/expression-def";
|
|
3
|
+
import { FieldSpace } from "../types/field-space";
|
|
4
4
|
export declare class ExprFunc extends ExpressionDef {
|
|
5
5
|
readonly name: string;
|
|
6
6
|
readonly args: ExpressionDef[];
|
|
@@ -28,7 +28,7 @@ const expression_def_1 = require("../types/expression-def");
|
|
|
28
28
|
const utils_1 = require("./utils");
|
|
29
29
|
class ExprFunc extends expression_def_1.ExpressionDef {
|
|
30
30
|
constructor(name, args) {
|
|
31
|
-
super({ args });
|
|
31
|
+
super({ "args": args });
|
|
32
32
|
this.name = name;
|
|
33
33
|
this.args = args;
|
|
34
34
|
this.elementType = "function call()";
|
|
@@ -53,9 +53,9 @@ class ExprFunc extends expression_def_1.ExpressionDef {
|
|
|
53
53
|
const dialect = fs.dialectObj();
|
|
54
54
|
const dataType = (_c = (_b = (_a = dialect === null || dialect === void 0 ? void 0 : dialect.getFunctionInfo(this.name)) === null || _a === void 0 ? void 0 : _a.returnType) !== null && _b !== void 0 ? _b : collectType) !== null && _c !== void 0 ? _c : "number";
|
|
55
55
|
return {
|
|
56
|
-
dataType: dataType,
|
|
56
|
+
"dataType": dataType,
|
|
57
57
|
expressionType,
|
|
58
|
-
value: (0, utils_1.compressExpr)(funcCall)
|
|
58
|
+
"value": (0, utils_1.compressExpr)(funcCall)
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
61
|
}
|
|
@@ -55,17 +55,17 @@ class ExprGranularTime extends expression_def_1.ExpressionDef {
|
|
|
55
55
|
if ((0, malloy_types_1.isTimeFieldType)(exprVal.dataType)) {
|
|
56
56
|
const tsVal = {
|
|
57
57
|
...exprVal,
|
|
58
|
-
dataType: exprVal.dataType,
|
|
59
|
-
timeframe: timeframe
|
|
58
|
+
"dataType": exprVal.dataType,
|
|
59
|
+
"timeframe": timeframe
|
|
60
60
|
};
|
|
61
61
|
if (this.truncate) {
|
|
62
62
|
tsVal.value = [
|
|
63
63
|
{
|
|
64
|
-
type: "dialect",
|
|
65
|
-
function: "trunc",
|
|
66
|
-
expr: { value: exprVal.value, valueType: exprVal.dataType },
|
|
67
|
-
units: timeframe
|
|
68
|
-
}
|
|
64
|
+
"type": "dialect",
|
|
65
|
+
"function": "trunc",
|
|
66
|
+
"expr": { "value": exprVal.value, "valueType": exprVal.dataType },
|
|
67
|
+
"units": timeframe
|
|
68
|
+
}
|
|
69
69
|
];
|
|
70
70
|
}
|
|
71
71
|
return tsVal;
|
|
@@ -32,7 +32,7 @@ class ExprIdReference extends expression_def_1.ExpressionDef {
|
|
|
32
32
|
super();
|
|
33
33
|
this.fieldReference = fieldReference;
|
|
34
34
|
this.elementType = "ExpressionIdReference";
|
|
35
|
-
this.has({ fieldPath: fieldReference });
|
|
35
|
+
this.has({ "fieldPath": fieldReference });
|
|
36
36
|
}
|
|
37
37
|
get refString() {
|
|
38
38
|
return this.fieldReference.refString;
|
|
@@ -40,10 +40,10 @@ class ExprIdReference extends expression_def_1.ExpressionDef {
|
|
|
40
40
|
getExpression(fs) {
|
|
41
41
|
const def = this.fieldReference.getField(fs);
|
|
42
42
|
if (def.found) {
|
|
43
|
-
const value = [{ type: def.found.refType, path: this.refString }];
|
|
43
|
+
const value = [{ "type": def.found.refType, "path": this.refString }];
|
|
44
44
|
return {
|
|
45
45
|
...def.found.typeDesc(),
|
|
46
|
-
value
|
|
46
|
+
value
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
49
|
this.log(def.error);
|
|
@@ -56,15 +56,15 @@ class ExprIdReference extends expression_def_1.ExpressionDef {
|
|
|
56
56
|
if ((0, malloy_types_1.isConditionParameter)(cParam)) {
|
|
57
57
|
const lval = expr.getExpression(fs);
|
|
58
58
|
return {
|
|
59
|
-
dataType: "boolean",
|
|
60
|
-
expressionType: lval.expressionType,
|
|
61
|
-
value: [
|
|
59
|
+
"dataType": "boolean",
|
|
60
|
+
"expressionType": lval.expressionType,
|
|
61
|
+
"value": [
|
|
62
62
|
{
|
|
63
|
-
type: "apply",
|
|
64
|
-
value: lval.value,
|
|
65
|
-
to: [{ type: "parameter", path: this.refString }]
|
|
66
|
-
}
|
|
67
|
-
]
|
|
63
|
+
"type": "apply",
|
|
64
|
+
"value": lval.value,
|
|
65
|
+
"to": [{ "type": "parameter", "path": this.refString }]
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
70
|
}
|
|
@@ -29,7 +29,7 @@ class ExprLogicalOp extends binary_boolean_1.BinaryBoolean {
|
|
|
29
29
|
constructor() {
|
|
30
30
|
super(...arguments);
|
|
31
31
|
this.elementType = "logical operator";
|
|
32
|
-
this.legalChildTypes = [fragtype_utils_1.FT.boolT, { ...fragtype_utils_1.FT.boolT, aggregate: true }];
|
|
32
|
+
this.legalChildTypes = [fragtype_utils_1.FT.boolT, { ...fragtype_utils_1.FT.boolT, "aggregate": true }];
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
exports.ExprLogicalOp = ExprLogicalOp;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExprValue } from "../types/expr-value";
|
|
2
|
-
import { FieldSpace } from "../types/field-space";
|
|
3
2
|
import { ExpressionDef } from "../types/expression-def";
|
|
3
|
+
import { FieldSpace } from "../types/field-space";
|
|
4
4
|
export declare class ExprMinus extends ExpressionDef {
|
|
5
5
|
readonly expr: ExpressionDef;
|
|
6
6
|
elementType: string;
|
|
@@ -28,7 +28,7 @@ const fragtype_utils_1 = require("../fragtype-utils");
|
|
|
28
28
|
const expression_def_1 = require("../types/expression-def");
|
|
29
29
|
class ExprMinus extends expression_def_1.ExpressionDef {
|
|
30
30
|
constructor(expr) {
|
|
31
|
-
super({ expr });
|
|
31
|
+
super({ "expr": expr });
|
|
32
32
|
this.expr = expr;
|
|
33
33
|
this.elementType = "unary minus";
|
|
34
34
|
this.legalChildTypes = [fragtype_utils_1.FT.numberT];
|
|
@@ -37,9 +37,9 @@ class ExprMinus extends expression_def_1.ExpressionDef {
|
|
|
37
37
|
const expr = this.expr.getExpression(fs);
|
|
38
38
|
if (this.typeCheck(this.expr, expr)) {
|
|
39
39
|
if (expr.value.length > 1) {
|
|
40
|
-
return { ...expr, value: ["-(", ...expr.value, ")"] };
|
|
40
|
+
return { ...expr, "value": ["-(", ...expr.value, ")"] };
|
|
41
41
|
}
|
|
42
|
-
return { ...expr, value: ["-", ...expr.value] };
|
|
42
|
+
return { ...expr, "value": ["-", ...expr.value] };
|
|
43
43
|
}
|
|
44
44
|
return (0, ast_utils_1.errorFor)("negate requires number");
|
|
45
45
|
}
|
|
@@ -38,8 +38,8 @@ class ExprNot extends unary_1.Unary {
|
|
|
38
38
|
if (this.typeCheck(this.expr, notThis)) {
|
|
39
39
|
return {
|
|
40
40
|
...notThis,
|
|
41
|
-
dataType: "boolean",
|
|
42
|
-
value: (0, utils_1.nullsafeNot)(notThis.value)
|
|
41
|
+
"dataType": "boolean",
|
|
42
|
+
"value": (0, utils_1.nullsafeNot)(notThis.value)
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
45
|
return (0, ast_utils_1.errorFor)("not requires boolean");
|
|
@@ -31,14 +31,14 @@ class ExprNow extends expression_def_1.ExpressionDef {
|
|
|
31
31
|
}
|
|
32
32
|
getExpression(_fs) {
|
|
33
33
|
return {
|
|
34
|
-
dataType: "timestamp",
|
|
35
|
-
expressionType: "scalar",
|
|
36
|
-
value: [
|
|
34
|
+
"dataType": "timestamp",
|
|
35
|
+
"expressionType": "scalar",
|
|
36
|
+
"value": [
|
|
37
37
|
{
|
|
38
|
-
type: "dialect",
|
|
39
|
-
function: "now"
|
|
40
|
-
}
|
|
41
|
-
]
|
|
38
|
+
"type": "dialect",
|
|
39
|
+
"function": "now"
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
}
|
|
@@ -31,9 +31,9 @@ class ExprNULL extends expression_def_1.ExpressionDef {
|
|
|
31
31
|
}
|
|
32
32
|
getExpression() {
|
|
33
33
|
return {
|
|
34
|
-
dataType: "null",
|
|
35
|
-
value: ["NULL"],
|
|
36
|
-
expressionType: "scalar"
|
|
34
|
+
"dataType": "null",
|
|
35
|
+
"value": ["NULL"],
|
|
36
|
+
"expressionType": "scalar"
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -35,7 +35,7 @@ class ExprNumber extends expression_def_1.ExpressionDef {
|
|
|
35
35
|
return this.constantExpression();
|
|
36
36
|
}
|
|
37
37
|
constantExpression() {
|
|
38
|
-
return { ...fragtype_utils_1.FT.numberT, value: [this.n] };
|
|
38
|
+
return { ...fragtype_utils_1.FT.numberT, "value": [this.n] };
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
exports.ExprNumber = ExprNumber;
|
|
@@ -26,7 +26,7 @@ exports.ExprParens = void 0;
|
|
|
26
26
|
const expression_def_1 = require("../types/expression-def");
|
|
27
27
|
class ExprParens extends expression_def_1.ExpressionDef {
|
|
28
28
|
constructor(expr) {
|
|
29
|
-
super({ expr });
|
|
29
|
+
super({ "expr": expr });
|
|
30
30
|
this.expr = expr;
|
|
31
31
|
this.elementType = "(expression)";
|
|
32
32
|
}
|
|
@@ -35,7 +35,7 @@ class ExprParens extends expression_def_1.ExpressionDef {
|
|
|
35
35
|
}
|
|
36
36
|
getExpression(fs) {
|
|
37
37
|
const subExpr = this.expr.getExpression(fs);
|
|
38
|
-
return { ...subExpr, value: ["(", ...subExpr.value, ")"] };
|
|
38
|
+
return { ...subExpr, "value": ["(", ...subExpr.value, ")"] };
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
exports.ExprParens = ExprParens;
|
|
@@ -32,9 +32,9 @@ class ExprRegEx extends expression_def_1.ExpressionDef {
|
|
|
32
32
|
}
|
|
33
33
|
getExpression() {
|
|
34
34
|
return {
|
|
35
|
-
dataType: "regular expression",
|
|
36
|
-
expressionType: "scalar",
|
|
37
|
-
value: [`r'${this.regex}'`]
|
|
35
|
+
"dataType": "regular expression",
|
|
36
|
+
"expressionType": "scalar",
|
|
37
|
+
"value": [`r'${this.regex}'`]
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
40
|
}
|
|
@@ -36,13 +36,13 @@ class ExprString extends expression_def_1.ExpressionDef {
|
|
|
36
36
|
getExpression(_fs) {
|
|
37
37
|
return {
|
|
38
38
|
...fragtype_utils_1.FT.stringT,
|
|
39
|
-
value: [
|
|
39
|
+
"value": [
|
|
40
40
|
{
|
|
41
|
-
type: "dialect",
|
|
42
|
-
function: "stringLiteral",
|
|
43
|
-
literal: this.value
|
|
44
|
-
}
|
|
45
|
-
]
|
|
41
|
+
"type": "dialect",
|
|
42
|
+
"function": "stringLiteral",
|
|
43
|
+
"literal": this.value
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
48
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FieldReference } from "../query-items/field-references";
|
|
2
|
-
import { ExprAsymmetric } from "./expr-asymmetric";
|
|
3
2
|
import { ExpressionDef } from "../types/expression-def";
|
|
3
|
+
import { ExprAsymmetric } from "./expr-asymmetric";
|
|
4
4
|
export declare class ExprSum extends ExprAsymmetric {
|
|
5
5
|
constructor(expr: ExpressionDef | undefined, source?: FieldReference);
|
|
6
6
|
}
|
|
@@ -5,7 +5,7 @@ const expr_asymmetric_1 = require("./expr-asymmetric");
|
|
|
5
5
|
class ExprSum extends expr_asymmetric_1.ExprAsymmetric {
|
|
6
6
|
constructor(expr, source) {
|
|
7
7
|
super("sum", expr, source);
|
|
8
|
-
this.has({ source });
|
|
8
|
+
this.has({ "source": source });
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
exports.ExprSum = ExprSum;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ExtractUnit } from "../../../model/malloy_types";
|
|
2
2
|
import { ExprValue } from "../types/expr-value";
|
|
3
|
-
import { FieldSpace } from "../types/field-space";
|
|
4
3
|
import { ExpressionDef } from "../types/expression-def";
|
|
4
|
+
import { FieldSpace } from "../types/field-space";
|
|
5
5
|
export declare class ExprTimeExtract extends ExpressionDef {
|
|
6
6
|
readonly extractText: string;
|
|
7
7
|
readonly args: ExpressionDef[];
|