@malloydata/malloy 0.0.427 → 0.0.428
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/lang/ast/expressions/apply.d.ts +1 -1
- package/dist/lang/ast/expressions/apply.js +2 -2
- package/dist/lang/ast/expressions/binary-boolean.d.ts +1 -1
- package/dist/lang/ast/expressions/binary-boolean.js +1 -1
- 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.d.ts +1 -1
- package/dist/lang/ast/expressions/boolean.js +1 -1
- package/dist/lang/ast/expressions/case.d.ts +1 -1
- package/dist/lang/ast/expressions/case.js +1 -1
- package/dist/lang/ast/expressions/constant-expression.d.ts +2 -1
- package/dist/lang/ast/expressions/constant-expression.js +6 -1
- package/dist/lang/ast/expressions/expr-aggregate-function.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-aggregate-function.js +14 -7
- package/dist/lang/ast/expressions/expr-alternation-tree.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-alternation-tree.js +1 -1
- package/dist/lang/ast/expressions/expr-array-literal.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-array-literal.js +1 -1
- package/dist/lang/ast/expressions/expr-cast.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-cast.js +1 -1
- package/dist/lang/ast/expressions/expr-coalesce.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-coalesce.js +1 -1
- package/dist/lang/ast/expressions/expr-compare.d.ts +4 -4
- package/dist/lang/ast/expressions/expr-compare.js +4 -4
- package/dist/lang/ast/expressions/expr-count.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-count.js +1 -1
- package/dist/lang/ast/expressions/expr-filter-expr.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-filter-expr.js +1 -1
- package/dist/lang/ast/expressions/expr-func.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-func.js +1 -1
- package/dist/lang/ast/expressions/expr-given.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-given.js +1 -1
- package/dist/lang/ast/expressions/expr-granular-time.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-granular-time.js +1 -1
- package/dist/lang/ast/expressions/expr-id-reference.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-id-reference.js +1 -1
- package/dist/lang/ast/expressions/expr-minus.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-minus.js +1 -1
- package/dist/lang/ast/expressions/expr-not.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-not.js +1 -1
- package/dist/lang/ast/expressions/expr-now.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-now.js +1 -1
- package/dist/lang/ast/expressions/expr-null.d.ts +3 -3
- package/dist/lang/ast/expressions/expr-null.js +14 -9
- package/dist/lang/ast/expressions/expr-number.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-number.js +1 -1
- package/dist/lang/ast/expressions/expr-parens.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-parens.js +5 -2
- package/dist/lang/ast/expressions/expr-props.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-props.js +1 -1
- package/dist/lang/ast/expressions/expr-record-literal.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-record-literal.js +1 -1
- package/dist/lang/ast/expressions/expr-regex.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-regex.js +1 -1
- package/dist/lang/ast/expressions/expr-string.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-string.js +1 -1
- package/dist/lang/ast/expressions/expr-time-extract.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-time-extract.js +1 -1
- package/dist/lang/ast/expressions/expr-time.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-time.js +1 -1
- package/dist/lang/ast/expressions/expr-ungroup.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-ungroup.js +1 -1
- 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/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 +1 -1
- package/dist/lang/ast/expressions/range.d.ts +1 -1
- package/dist/lang/ast/expressions/range.js +1 -1
- package/dist/lang/ast/expressions/time-literal.d.ts +2 -2
- package/dist/lang/ast/expressions/time-literal.js +2 -2
- package/dist/lang/ast/field-space/parameter-space.d.ts +1 -0
- package/dist/lang/ast/field-space/parameter-space.js +6 -0
- package/dist/lang/ast/field-space/passthrough-space.d.ts +1 -0
- package/dist/lang/ast/field-space/passthrough-space.js +3 -0
- package/dist/lang/ast/field-space/static-space.d.ts +8 -0
- package/dist/lang/ast/field-space/static-space.js +14 -0
- package/dist/lang/ast/query-builders/index-builder.js +1 -1
- package/dist/lang/ast/query-properties/drill.d.ts +1 -1
- package/dist/lang/ast/query-properties/drill.js +1 -1
- package/dist/lang/ast/types/expression-def.d.ts +50 -23
- package/dist/lang/ast/types/expression-def.js +127 -65
- package/dist/lang/ast/types/field-space.d.ts +14 -0
- package/dist/lang/ast/types/field-space.js +36 -0
- package/dist/model/malloy_types.d.ts +0 -13
- package/dist/model/malloy_types.js +0 -19
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
|
@@ -7,5 +7,5 @@ export declare class Apply extends ExprCompare {
|
|
|
7
7
|
readonly right: ExpressionDef;
|
|
8
8
|
elementType: string;
|
|
9
9
|
constructor(left: ExpressionDef, right: ExpressionDef);
|
|
10
|
-
|
|
10
|
+
protected computeExpression(fs: FieldSpace): ExprValue;
|
|
11
11
|
}
|
|
@@ -15,7 +15,7 @@ class Apply extends expr_compare_1.ExprCompare {
|
|
|
15
15
|
this.right = right;
|
|
16
16
|
this.elementType = 'apply';
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
computeExpression(fs) {
|
|
19
19
|
let right = this.right;
|
|
20
20
|
if (!this.right.granular()) {
|
|
21
21
|
const rhs = this.right.requestExpression(fs);
|
|
@@ -27,7 +27,7 @@ class Apply extends expr_compare_1.ExprCompare {
|
|
|
27
27
|
if (right instanceof expr_granular_time_1.ExprGranularTime) {
|
|
28
28
|
return right.toRange(fs).apply(fs, this.op, this.left);
|
|
29
29
|
}
|
|
30
|
-
return super.
|
|
30
|
+
return super.computeExpression(fs);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
exports.Apply = Apply;
|
|
@@ -9,5 +9,5 @@ export declare abstract class BinaryBoolean<opType extends BinaryMalloyOperator>
|
|
|
9
9
|
elementType: string;
|
|
10
10
|
legalChildTypes: import("../../..").TypeDesc[];
|
|
11
11
|
constructor(left: ExpressionDef, op: opType, right: ExpressionDef);
|
|
12
|
-
|
|
12
|
+
protected computeExpression(fs: FieldSpace): ExprValue;
|
|
13
13
|
}
|
|
@@ -52,7 +52,7 @@ class BinaryBoolean extends expression_def_1.ExpressionDef {
|
|
|
52
52
|
this.elementType = 'abstract boolean binary';
|
|
53
53
|
this.legalChildTypes = [TDU.boolT];
|
|
54
54
|
}
|
|
55
|
-
|
|
55
|
+
computeExpression(fs) {
|
|
56
56
|
const left = this.left.getExpression(fs);
|
|
57
57
|
const right = this.right.getExpression(fs);
|
|
58
58
|
if (this.typeCheck(this.left, left) && this.typeCheck(this.right, right)) {
|
|
@@ -8,5 +8,5 @@ export declare abstract class BinaryNumeric<opType extends ArithmeticMalloyOpera
|
|
|
8
8
|
readonly right: ExpressionDef;
|
|
9
9
|
elementType: string;
|
|
10
10
|
constructor(left: ExpressionDef, op: opType, right: ExpressionDef);
|
|
11
|
-
|
|
11
|
+
protected computeExpression(fs: FieldSpace): ExprValue;
|
|
12
12
|
}
|
|
@@ -49,7 +49,7 @@ class BinaryNumeric extends expression_def_1.ExpressionDef {
|
|
|
49
49
|
this.elementType = 'numeric binary abstract';
|
|
50
50
|
this.legalChildTypes = [TDU.numberT];
|
|
51
51
|
}
|
|
52
|
-
|
|
52
|
+
computeExpression(fs) {
|
|
53
53
|
return this.right.apply(fs, this.op, this.left);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
@@ -5,6 +5,6 @@ export declare class Boolean extends ExpressionDef {
|
|
|
5
5
|
readonly value: 'true' | 'false';
|
|
6
6
|
elementType: string;
|
|
7
7
|
constructor(value: 'true' | 'false');
|
|
8
|
-
|
|
8
|
+
protected computeExpression(): ExprValue;
|
|
9
9
|
getStableLiteral(): Malloy.LiteralValue;
|
|
10
10
|
}
|
|
@@ -8,7 +8,7 @@ export declare class Case extends ExpressionDef {
|
|
|
8
8
|
readonly elseValue?: ExpressionDef | undefined;
|
|
9
9
|
elementType: string;
|
|
10
10
|
constructor(value: ExpressionDef | undefined, choices: CaseWhen[], elseValue?: ExpressionDef | undefined);
|
|
11
|
-
|
|
11
|
+
protected computeExpression(fs: FieldSpace): ExprValue;
|
|
12
12
|
}
|
|
13
13
|
export declare class CaseWhen extends MalloyElement {
|
|
14
14
|
readonly when: ExpressionDef;
|
|
@@ -17,13 +17,14 @@ export declare class ConstantFieldSpace implements FieldSpace {
|
|
|
17
17
|
connectionName(): string;
|
|
18
18
|
isQueryFieldSpace(): this is QueryFieldSpace;
|
|
19
19
|
accessProtectionLevel(): AccessModifierLabel;
|
|
20
|
+
generation(): number;
|
|
20
21
|
}
|
|
21
22
|
export declare class ConstantExpression extends ExpressionDef {
|
|
22
23
|
readonly expr: ExpressionDef;
|
|
23
24
|
elementType: string;
|
|
24
25
|
private cfs?;
|
|
25
26
|
constructor(expr: ExpressionDef);
|
|
26
|
-
|
|
27
|
+
protected computeExpression(_fs: FieldSpace): ExprValue;
|
|
27
28
|
private get constantFs();
|
|
28
29
|
constantValue(): ExprValue;
|
|
29
30
|
apply(fs: FieldSpace, op: BinaryMalloyOperator, expr: ExpressionDef): ExprValue;
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.ConstantExpression = exports.ConstantFieldSpace = void 0;
|
|
8
8
|
const expression_def_1 = require("../types/expression-def");
|
|
9
|
+
const field_space_1 = require("../types/field-space");
|
|
9
10
|
class ConstantFieldSpace {
|
|
10
11
|
constructor() {
|
|
11
12
|
this.type = 'fieldSpace';
|
|
@@ -46,6 +47,10 @@ class ConstantFieldSpace {
|
|
|
46
47
|
accessProtectionLevel() {
|
|
47
48
|
return 'private';
|
|
48
49
|
}
|
|
50
|
+
// Binds nothing at all -- every lookup is an error.
|
|
51
|
+
generation() {
|
|
52
|
+
return (0, field_space_1.currentGeneration)();
|
|
53
|
+
}
|
|
49
54
|
}
|
|
50
55
|
exports.ConstantFieldSpace = ConstantFieldSpace;
|
|
51
56
|
class ConstantExpression extends expression_def_1.ExpressionDef {
|
|
@@ -54,7 +59,7 @@ class ConstantExpression extends expression_def_1.ExpressionDef {
|
|
|
54
59
|
this.expr = expr;
|
|
55
60
|
this.elementType = 'constantExpression';
|
|
56
61
|
}
|
|
57
|
-
|
|
62
|
+
computeExpression(_fs) {
|
|
58
63
|
return this.constantValue();
|
|
59
64
|
}
|
|
60
65
|
get constantFs() {
|
|
@@ -13,7 +13,7 @@ export declare abstract class ExprAggregateFunction extends ExpressionDef {
|
|
|
13
13
|
legalChildTypes: import("../../..").TypeDesc[];
|
|
14
14
|
constructor(func: AggregateFunctionType, expr?: ExpressionDef, explicitSource?: boolean);
|
|
15
15
|
abstract returns(fromExpr: ExprValue): ExprValue;
|
|
16
|
-
|
|
16
|
+
protected computeExpression(fs: FieldSpace): ExprValue;
|
|
17
17
|
isSymmetricFunction(): boolean;
|
|
18
18
|
getJoinUsage(fs: FieldSpace): JoinPath[];
|
|
19
19
|
}
|
|
@@ -59,7 +59,7 @@ class ExprAggregateFunction extends expression_def_1.ExpressionDef {
|
|
|
59
59
|
this.has({ expr: expr });
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
|
|
62
|
+
computeExpression(fs) {
|
|
63
63
|
var _a, _b, _c;
|
|
64
64
|
// It is never useful to use output fields in an aggregate expression
|
|
65
65
|
// so we don't even allow them to be referenced at all
|
|
@@ -162,15 +162,22 @@ class ExprAggregateFunction extends expression_def_1.ExpressionDef {
|
|
|
162
162
|
if (structPath && structPath.length > 0) {
|
|
163
163
|
f.structPath = structPath;
|
|
164
164
|
}
|
|
165
|
+
// `returns` is identity for sum and a shallow copy for avg, so
|
|
166
|
+
// returnExpr shares the operand's refSummary -- build a new one rather
|
|
167
|
+
// than writing into it.
|
|
165
168
|
const returnExpr = this.returns(exprVal);
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
169
|
+
const refSummary = this.isSymmetricFunction()
|
|
170
|
+
? returnExpr.refSummary
|
|
171
|
+
: {
|
|
172
|
+
...returnExpr.refSummary,
|
|
173
|
+
fieldUsage: [
|
|
174
|
+
...(0, malloy_types_1.fieldUsageFrom)(returnExpr.refSummary),
|
|
175
|
+
{ path: structPath || [], uniqueKeyRequirement: { isCount: false } },
|
|
176
|
+
],
|
|
177
|
+
};
|
|
172
178
|
return {
|
|
173
179
|
...returnExpr,
|
|
180
|
+
refSummary,
|
|
174
181
|
expressionType: 'aggregate',
|
|
175
182
|
value: f,
|
|
176
183
|
evalSpace: 'output',
|
|
@@ -12,6 +12,6 @@ export declare class ExprAlternationTree extends ExpressionDef {
|
|
|
12
12
|
equalityList(): ExpressionDef[];
|
|
13
13
|
apply(fs: FieldSpace, applyOp: BinaryMalloyOperator, expr: ExpressionDef, warnOnComplexTree: boolean): ExprValue;
|
|
14
14
|
requestExpression(_fs: FieldSpace): ExprValue | undefined;
|
|
15
|
-
|
|
15
|
+
protected computeExpression(_fs: FieldSpace): ExprValue;
|
|
16
16
|
atNodeType(): ATNodeType;
|
|
17
17
|
}
|
|
@@ -86,7 +86,7 @@ class ExprAlternationTree extends expression_def_1.ExpressionDef {
|
|
|
86
86
|
requestExpression(_fs) {
|
|
87
87
|
return undefined;
|
|
88
88
|
}
|
|
89
|
-
|
|
89
|
+
computeExpression(_fs) {
|
|
90
90
|
return this.loggedErrorExpr('alternation-as-value', 'Alternation tree has no value');
|
|
91
91
|
}
|
|
92
92
|
atNodeType() {
|
|
@@ -18,7 +18,7 @@ class ExprCast extends expression_def_1.ExpressionDef {
|
|
|
18
18
|
}
|
|
19
19
|
// TODO: Validate senseless casts (e.g. scalar to record) at translate time
|
|
20
20
|
// for better error messages than what the dialect/database produces.
|
|
21
|
-
|
|
21
|
+
computeExpression(fs) {
|
|
22
22
|
const expr = this.expr.getExpression(fs);
|
|
23
23
|
let dataType = { type: 'error' };
|
|
24
24
|
if ('type' in this.castType) {
|
|
@@ -7,5 +7,5 @@ export declare class ExprCoalesce extends ExpressionDef {
|
|
|
7
7
|
elementType: string;
|
|
8
8
|
legalChildTypes: import("../../..").TypeDesc[];
|
|
9
9
|
constructor(expr: ExpressionDef, altExpr: ExpressionDef);
|
|
10
|
-
|
|
10
|
+
protected computeExpression(fs: FieldSpace): ExprValue;
|
|
11
11
|
}
|
|
@@ -50,7 +50,7 @@ class ExprCoalesce extends expression_def_1.ExpressionDef {
|
|
|
50
50
|
this.elementType = 'coalesce expression';
|
|
51
51
|
this.legalChildTypes = TDU.anyAtomicT;
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
computeExpression(fs) {
|
|
54
54
|
const maybeNull = this.expr.getExpression(fs);
|
|
55
55
|
const whenNull = this.altExpr.getExpression(fs);
|
|
56
56
|
if (maybeNull.type === 'null') {
|
|
@@ -7,7 +7,7 @@ import type { GivenReference } from './expr-given';
|
|
|
7
7
|
export declare class ExprCompare extends BinaryBoolean<CompareMalloyOperator> {
|
|
8
8
|
elementType: string;
|
|
9
9
|
constructor(left: ExpressionDef, op: CompareMalloyOperator, right: ExpressionDef);
|
|
10
|
-
|
|
10
|
+
protected computeExpression(fs: FieldSpace): ExprValue;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* The parser makes equality nodes, an application of ?
|
|
@@ -18,7 +18,7 @@ export declare class ExprCompare extends BinaryBoolean<CompareMalloyOperator> {
|
|
|
18
18
|
export declare class ExprEquality extends ExprCompare {
|
|
19
19
|
elementType: string;
|
|
20
20
|
constructor(left: ExpressionDef, op: EqualityMalloyOperator, right: ExpressionDef);
|
|
21
|
-
|
|
21
|
+
protected computeExpression(fs: FieldSpace): ExprValue;
|
|
22
22
|
apply(fs: FieldSpace, op: BinaryMalloyOperator, left: ExpressionDef): ExprValue;
|
|
23
23
|
}
|
|
24
24
|
export declare class ExprLegacyIn extends ExpressionDef {
|
|
@@ -27,7 +27,7 @@ export declare class ExprLegacyIn extends ExpressionDef {
|
|
|
27
27
|
readonly choices: ExpressionDef[];
|
|
28
28
|
elementType: string;
|
|
29
29
|
constructor(expr: ExpressionDef, notIn: boolean, choices: ExpressionDef[]);
|
|
30
|
-
|
|
30
|
+
protected computeExpression(fs: FieldSpace): ExprValue;
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
33
|
* `expr in $ARRAY_GIVEN` — runtime test of a basic-typed expression
|
|
@@ -41,5 +41,5 @@ export declare class ExprInGiven extends ExpressionDef {
|
|
|
41
41
|
readonly givenRef: GivenReference;
|
|
42
42
|
elementType: string;
|
|
43
43
|
constructor(expr: ExpressionDef, notIn: boolean, givenRef: GivenReference);
|
|
44
|
-
|
|
44
|
+
protected computeExpression(fs: FieldSpace): ExprValue;
|
|
45
45
|
}
|
|
@@ -61,7 +61,7 @@ class ExprCompare extends binary_boolean_1.BinaryBoolean {
|
|
|
61
61
|
this.elementType = 'a<=>b';
|
|
62
62
|
this.legalChildTypes = compareTypes[op];
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
computeExpression(fs) {
|
|
65
65
|
return this.right.apply(fs, this.op, this.left);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
@@ -77,7 +77,7 @@ class ExprEquality extends ExprCompare {
|
|
|
77
77
|
super(left, op, right);
|
|
78
78
|
this.elementType = 'a~=b';
|
|
79
79
|
}
|
|
80
|
-
|
|
80
|
+
computeExpression(fs) {
|
|
81
81
|
return this.right.apply(fs, this.op, this.left, true);
|
|
82
82
|
}
|
|
83
83
|
apply(fs, op, left) {
|
|
@@ -94,7 +94,7 @@ class ExprLegacyIn extends expression_def_1.ExpressionDef {
|
|
|
94
94
|
this.elementType = 'in';
|
|
95
95
|
this.has({ expr, choices });
|
|
96
96
|
}
|
|
97
|
-
|
|
97
|
+
computeExpression(fs) {
|
|
98
98
|
const lookFor = this.expr.getExpression(fs);
|
|
99
99
|
const oneOf = this.choices.map(e => e.getExpression(fs));
|
|
100
100
|
return (0, expr_value_2.computedExprValue)({
|
|
@@ -124,7 +124,7 @@ class ExprInGiven extends expression_def_1.ExpressionDef {
|
|
|
124
124
|
this.elementType = 'inGiven';
|
|
125
125
|
this.has({ expr, givenRef });
|
|
126
126
|
}
|
|
127
|
-
|
|
127
|
+
computeExpression(fs) {
|
|
128
128
|
const lookFor = this.expr.getExpression(fs);
|
|
129
129
|
const givenVal = this.givenRef.getExpression(fs);
|
|
130
130
|
// `in` is logically a boolean — every error path returns a
|
|
@@ -8,5 +8,5 @@ export declare class ExprCount extends ExprAggregateFunction {
|
|
|
8
8
|
constructor(source?: FieldReference | undefined);
|
|
9
9
|
defaultFieldName(): string | undefined;
|
|
10
10
|
returns(ev: ExprValue): ExprValue;
|
|
11
|
-
|
|
11
|
+
protected computeExpression(_fs: FieldSpace): ExprValue;
|
|
12
12
|
}
|
|
@@ -12,7 +12,7 @@ class ExprFilterExpression extends expression_def_1.ExpressionDef {
|
|
|
12
12
|
this.filterText = filterText;
|
|
13
13
|
this.elementType = 'filter expression literal';
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
computeExpression() {
|
|
16
16
|
return {
|
|
17
17
|
type: 'filter expression',
|
|
18
18
|
value: { node: 'filterLiteral', filterSrc: this.filterText },
|
|
@@ -17,7 +17,7 @@ export declare class ExprFunc extends ExpressionDef {
|
|
|
17
17
|
canSupportPartitionBy(): boolean;
|
|
18
18
|
canSupportOrderBy(): boolean;
|
|
19
19
|
canSupportLimit(): boolean;
|
|
20
|
-
|
|
20
|
+
protected computeExpression(fs: FieldSpace): ExprValue;
|
|
21
21
|
private findFunctionDef;
|
|
22
22
|
getPropsExpression(fs: FieldSpace, props?: {
|
|
23
23
|
partitionBys?: PartitionBy[];
|
|
@@ -79,7 +79,7 @@ class ExprFunc extends expression_def_1.ExpressionDef {
|
|
|
79
79
|
canSupportLimit() {
|
|
80
80
|
return true;
|
|
81
81
|
}
|
|
82
|
-
|
|
82
|
+
computeExpression(fs) {
|
|
83
83
|
if (this.isRaw && this.isRestricted()) {
|
|
84
84
|
const typeStr = this.explicitType
|
|
85
85
|
? (0, utils_1.typeDefToString)(this.explicitType)
|
|
@@ -23,7 +23,7 @@ class GivenReference extends expression_def_1.ExpressionDef {
|
|
|
23
23
|
this.name = name;
|
|
24
24
|
this.elementType = 'givenReference';
|
|
25
25
|
}
|
|
26
|
-
|
|
26
|
+
computeExpression(_fs) {
|
|
27
27
|
var _a;
|
|
28
28
|
const doc = this.document();
|
|
29
29
|
const entry = (_a = doc === null || doc === void 0 ? void 0 : doc.getEntry(this.name)) === null || _a === void 0 ? void 0 : _a.entry;
|
|
@@ -20,6 +20,6 @@ export declare class ExprGranularTime extends ExpressionDef {
|
|
|
20
20
|
constructor(expr: ExpressionDef, units: TimestampUnit, truncate: boolean);
|
|
21
21
|
granular(): boolean;
|
|
22
22
|
drillExpression(): Malloy.Expression | undefined;
|
|
23
|
-
|
|
23
|
+
protected computeExpression(fs: FieldSpace): ExprValue;
|
|
24
24
|
toRange(fs: FieldSpace): Range;
|
|
25
25
|
}
|
|
@@ -9,5 +9,5 @@ export declare class ExprIdReference extends ExpressionDef {
|
|
|
9
9
|
constructor(fieldReference: FieldReference);
|
|
10
10
|
get refString(): string;
|
|
11
11
|
drillExpression(): Malloy.Expression | undefined;
|
|
12
|
-
|
|
12
|
+
protected computeExpression(fs: FieldSpace): ExprValue;
|
|
13
13
|
}
|
|
@@ -24,7 +24,7 @@ class ExprIdReference extends expression_def_1.ExpressionDef {
|
|
|
24
24
|
path: this.fieldReference.path.slice(0, -1),
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
computeExpression(fs) {
|
|
28
28
|
const def = this.fieldReference.getField(fs);
|
|
29
29
|
if (def.found) {
|
|
30
30
|
// TODO Currently the join usage is always equivalent to the reference path here;
|
|
@@ -48,7 +48,7 @@ class ExprMinus extends expression_def_1.ExpressionDef {
|
|
|
48
48
|
this.elementType = 'unary minus';
|
|
49
49
|
this.legalChildTypes = [TDU.numberT];
|
|
50
50
|
}
|
|
51
|
-
|
|
51
|
+
computeExpression(fs) {
|
|
52
52
|
const expr = this.expr.getExpression(fs);
|
|
53
53
|
if (TDU.typeIn(expr, this.legalChildTypes)) {
|
|
54
54
|
return {
|
|
@@ -46,7 +46,7 @@ class ExprNot extends unary_1.Unary {
|
|
|
46
46
|
this.elementType = 'not';
|
|
47
47
|
this.legalChildTypes = [TDU.boolT, TDU.nullT];
|
|
48
48
|
}
|
|
49
|
-
|
|
49
|
+
computeExpression(fs) {
|
|
50
50
|
var _a;
|
|
51
51
|
const notThis = this.expr.getExpression(fs);
|
|
52
52
|
if (((_a = fs.dialectObj()) === null || _a === void 0 ? void 0 : _a.booleanType) !== 'supported') {
|
|
@@ -3,5 +3,5 @@ import type { FieldSpace } from '../types/field-space';
|
|
|
3
3
|
import { ExpressionDef } from '../types/expression-def';
|
|
4
4
|
export declare class ExprNow extends ExpressionDef {
|
|
5
5
|
elementType: string;
|
|
6
|
-
|
|
6
|
+
protected computeExpression(_fs: FieldSpace): ExprValue;
|
|
7
7
|
}
|
|
@@ -3,7 +3,7 @@ import type { ExprValue } from '../types/expr-value';
|
|
|
3
3
|
import { ATNodeType, ExpressionDef } from '../types/expression-def';
|
|
4
4
|
export declare class ExprNULL extends ExpressionDef {
|
|
5
5
|
elementType: string;
|
|
6
|
-
|
|
6
|
+
protected computeExpression(): ExprValue;
|
|
7
7
|
apply(fs: FieldSpace, op: BinaryMalloyOperator, left: ExpressionDef): ExprValue;
|
|
8
8
|
}
|
|
9
9
|
export declare class PartialIsNull extends ExpressionDef {
|
|
@@ -12,7 +12,7 @@ export declare class PartialIsNull extends ExpressionDef {
|
|
|
12
12
|
constructor(op: '=' | '!=');
|
|
13
13
|
apply(fs: FieldSpace, op: string, expr: ExpressionDef): ExprValue;
|
|
14
14
|
requestExpression(_fs: FieldSpace): ExprValue | undefined;
|
|
15
|
-
|
|
15
|
+
protected computeExpression(_fs: FieldSpace): ExprValue;
|
|
16
16
|
atNodeType(): ATNodeType;
|
|
17
17
|
}
|
|
18
18
|
export declare class ExprIsNull extends ExpressionDef {
|
|
@@ -20,5 +20,5 @@ export declare class ExprIsNull extends ExpressionDef {
|
|
|
20
20
|
readonly op: '=' | '!=';
|
|
21
21
|
elementType: string;
|
|
22
22
|
constructor(expr: ExpressionDef, op: '=' | '!=');
|
|
23
|
-
|
|
23
|
+
protected computeExpression(fs: FieldSpace): ExprValue;
|
|
24
24
|
}
|
|
@@ -8,20 +8,25 @@ exports.ExprIsNull = exports.PartialIsNull = exports.ExprNULL = void 0;
|
|
|
8
8
|
const expr_value_1 = require("../types/expr-value");
|
|
9
9
|
const expression_def_1 = require("../types/expression-def");
|
|
10
10
|
function doIsNull(fs, op, expr) {
|
|
11
|
+
// Build a new value rather than retyping the operand's in place: what
|
|
12
|
+
// getExpression hands back is shared, and the operand is usually asked for
|
|
13
|
+
// its value again after this.
|
|
11
14
|
const nullCmp = expr.getExpression(fs);
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
return (0, expr_value_1.computedExprValue)({
|
|
16
|
+
dataType: { type: 'boolean' },
|
|
17
|
+
value: {
|
|
18
|
+
node: op === '=' ? 'is-null' : 'is-not-null',
|
|
19
|
+
e: nullCmp.value,
|
|
20
|
+
},
|
|
21
|
+
from: [nullCmp],
|
|
22
|
+
});
|
|
18
23
|
}
|
|
19
24
|
class ExprNULL extends expression_def_1.ExpressionDef {
|
|
20
25
|
constructor() {
|
|
21
26
|
super(...arguments);
|
|
22
27
|
this.elementType = 'NULL';
|
|
23
28
|
}
|
|
24
|
-
|
|
29
|
+
computeExpression() {
|
|
25
30
|
return (0, expr_value_1.literalExprValue)({
|
|
26
31
|
dataType: { type: 'null' },
|
|
27
32
|
value: { node: 'null' },
|
|
@@ -47,7 +52,7 @@ class PartialIsNull extends expression_def_1.ExpressionDef {
|
|
|
47
52
|
requestExpression(_fs) {
|
|
48
53
|
return undefined;
|
|
49
54
|
}
|
|
50
|
-
|
|
55
|
+
computeExpression(_fs) {
|
|
51
56
|
return this.loggedErrorExpr('partial-as-value', 'Partial null check does not have a value');
|
|
52
57
|
}
|
|
53
58
|
atNodeType() {
|
|
@@ -63,7 +68,7 @@ class ExprIsNull extends expression_def_1.ExpressionDef {
|
|
|
63
68
|
this.elementType = 'is null';
|
|
64
69
|
this.has({ expr });
|
|
65
70
|
}
|
|
66
|
-
|
|
71
|
+
computeExpression(fs) {
|
|
67
72
|
return doIsNull(fs, this.op, this.expr);
|
|
68
73
|
}
|
|
69
74
|
}
|
|
@@ -6,7 +6,7 @@ export declare class ExprNumber extends ExpressionDef {
|
|
|
6
6
|
readonly n: string;
|
|
7
7
|
elementType: string;
|
|
8
8
|
constructor(n: string);
|
|
9
|
-
|
|
9
|
+
protected computeExpression(fs: FieldSpace): ExprValue;
|
|
10
10
|
/**
|
|
11
11
|
* Default number type when no dialect is available.
|
|
12
12
|
* Integers default to bigint for safety, floats to float.
|
|
@@ -13,7 +13,7 @@ class ExprNumber extends expression_def_1.ExpressionDef {
|
|
|
13
13
|
this.n = n;
|
|
14
14
|
this.elementType = 'numeric literal';
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
computeExpression(fs) {
|
|
17
17
|
var _a;
|
|
18
18
|
const dialect = fs.dialectObj();
|
|
19
19
|
const dataType = (_a = dialect === null || dialect === void 0 ? void 0 : dialect.literalNumberType(this.n)) !== null && _a !== void 0 ? _a : this.defaultNumberType();
|
|
@@ -7,7 +7,7 @@ export declare class ExprParens extends ExpressionDef {
|
|
|
7
7
|
elementType: string;
|
|
8
8
|
constructor(expr: ExpressionDef);
|
|
9
9
|
requestExpression(fs: FieldSpace): ExprValue | undefined;
|
|
10
|
-
|
|
10
|
+
protected computeExpression(fs: FieldSpace): ExprValue;
|
|
11
11
|
apply(fs: FieldSpace, op: BinaryMalloyOperator, left: ExpressionDef, doWarn: boolean): ExprValue;
|
|
12
12
|
atNodeType(): ATNodeType;
|
|
13
13
|
atExpr(): ExpressionDef;
|