@malloydata/malloy 0.0.427 → 0.0.429
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/api/foundation/build_targets.d.ts +50 -0
- package/dist/api/foundation/build_targets.js +221 -0
- package/dist/api/foundation/core.d.ts +54 -10
- package/dist/api/foundation/core.js +80 -17
- package/dist/api/foundation/index.d.ts +1 -1
- package/dist/api/foundation/runtime.d.ts +18 -1
- package/dist/api/foundation/runtime.js +35 -0
- package/dist/api/foundation/types.d.ts +93 -6
- package/dist/index.d.ts +1 -1
- 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/dynamic-space.js +20 -3
- 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-elements/query-arrow.d.ts +1 -1
- package/dist/lang/ast/query-elements/query-arrow.js +10 -4
- package/dist/lang/ast/query-elements/query-base.d.ts +1 -1
- package/dist/lang/ast/query-elements/query-base.js +1 -6
- package/dist/lang/ast/query-elements/query-raw.d.ts +1 -1
- package/dist/lang/ast/query-elements/query-raw.js +4 -2
- package/dist/lang/ast/query-elements/query-reference.d.ts +1 -1
- package/dist/lang/ast/query-elements/query-reference.js +9 -3
- package/dist/lang/ast/query-elements/query-refine.d.ts +1 -1
- package/dist/lang/ast/query-elements/query-refine.js +10 -4
- 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/source-elements/query-source.js +1 -1
- package/dist/lang/ast/source-elements/sql-source.js +2 -2
- package/dist/lang/ast/source-query-elements/source-query-element.d.ts +27 -0
- package/dist/lang/ast/source-query-elements/source-query-element.js +33 -0
- package/dist/lang/ast/source-query-elements/sq-arrow.d.ts +2 -0
- package/dist/lang/ast/source-query-elements/sq-arrow.js +12 -6
- package/dist/lang/ast/source-query-elements/sq-refine.d.ts +2 -0
- package/dist/lang/ast/source-query-elements/sq-refine.js +12 -6
- package/dist/lang/ast/source-query-elements/sq-source.d.ts +1 -0
- package/dist/lang/ast/source-query-elements/sq-source.js +6 -3
- package/dist/lang/ast/sql-elements/sql-string.d.ts +1 -1
- package/dist/lang/ast/sql-elements/sql-string.js +25 -5
- package/dist/lang/ast/statements/import-statement.js +7 -10
- 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/lang/ast/types/query-element.d.ts +15 -1
- package/dist/lang/parse-log.d.ts +2 -0
- package/dist/lang/test/test-translator.d.ts +17 -0
- package/dist/lang/test/test-translator.js +46 -2
- package/dist/model/malloy_types.d.ts +0 -13
- package/dist/model/malloy_types.js +0 -19
- package/dist/model/persist_utils.d.ts +61 -10
- package/dist/model/persist_utils.js +172 -63
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
|
@@ -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;
|
|
@@ -15,15 +15,18 @@ class ExprParens extends expression_def_1.ExpressionDef {
|
|
|
15
15
|
requestExpression(fs) {
|
|
16
16
|
return this.expr.requestExpression(fs);
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
computeExpression(fs) {
|
|
19
19
|
const subExpr = this.expr.getExpression(fs);
|
|
20
20
|
return { ...subExpr, value: { node: '()', e: subExpr.value } };
|
|
21
21
|
}
|
|
22
22
|
apply(fs, op, left, doWarn) {
|
|
23
23
|
if (this.expr.atNodeType() === expression_def_1.ATNodeType.Or) {
|
|
24
|
+
// Parens are invisible to `?`/`=`, so hand the tree the operator and
|
|
25
|
+
// doWarn, which decides whether an un-collapsible `|` list is worth a
|
|
26
|
+
// warning. The base ignores doWarn, which is why it is not passed on.
|
|
24
27
|
return this.expr.apply(fs, op, left, doWarn);
|
|
25
28
|
}
|
|
26
|
-
return
|
|
29
|
+
return super.apply(fs, op, left);
|
|
27
30
|
}
|
|
28
31
|
atNodeType() {
|
|
29
32
|
return this.expr.atNodeType();
|
|
@@ -10,7 +10,7 @@ export declare class ExprProps extends ExpressionDef {
|
|
|
10
10
|
legalChildTypes: import("../../..").TypeDesc[];
|
|
11
11
|
constructor(expr: ExpressionDef, statements: FieldPropStatement[]);
|
|
12
12
|
private getFilteredExpression;
|
|
13
|
-
|
|
13
|
+
protected computeExpression(fs: FieldSpace): ExprValue;
|
|
14
14
|
getGroupedBys(fs: FieldSpace, expr: ExprValue, groupedBys: GroupedBy[]): {
|
|
15
15
|
requiresGroupBy: import("../../../model").RequiredGroupBy[] | undefined;
|
|
16
16
|
type: "string";
|
|
@@ -19,7 +19,7 @@ export declare class RecordLiteral extends ExpressionDef {
|
|
|
19
19
|
readonly pairs: RecordElement[];
|
|
20
20
|
elementType: string;
|
|
21
21
|
constructor(pairs: RecordElement[]);
|
|
22
|
-
|
|
22
|
+
protected computeExpression(fs: FieldSpace): ExprValue;
|
|
23
23
|
getRecord(fs: FieldSpace, kidNames: string[]): ExprValue;
|
|
24
24
|
getNextElement(fs: FieldSpace, headValue: ExprValue): ExprValue;
|
|
25
25
|
}
|
|
@@ -13,7 +13,7 @@ class ExprRegEx extends expression_def_1.ExpressionDef {
|
|
|
13
13
|
this.regex = regex;
|
|
14
14
|
this.elementType = 'regular expression literal';
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
computeExpression() {
|
|
17
17
|
return (0, expr_value_1.literalExprValue)({
|
|
18
18
|
dataType: { type: 'regular expression' },
|
|
19
19
|
value: { node: 'regexpLiteral', literal: this.regex },
|
|
@@ -6,6 +6,6 @@ export declare class ExprString extends ExpressionDef {
|
|
|
6
6
|
elementType: string;
|
|
7
7
|
value: string;
|
|
8
8
|
constructor(src: string);
|
|
9
|
-
|
|
9
|
+
protected computeExpression(_fs: FieldSpace): ExprValue;
|
|
10
10
|
getStableLiteral(): Malloy.LiteralValue;
|
|
11
11
|
}
|
|
@@ -13,7 +13,7 @@ class ExprString extends expression_def_1.ExpressionDef {
|
|
|
13
13
|
this.elementType = 'string literal';
|
|
14
14
|
this.value = src;
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
computeExpression(_fs) {
|
|
17
17
|
return (0, expr_value_1.literalExprValue)({
|
|
18
18
|
dataType: { type: 'string' },
|
|
19
19
|
value: { node: 'stringLiteral', literal: this.value },
|
|
@@ -9,5 +9,5 @@ export declare class ExprTimeExtract extends ExpressionDef {
|
|
|
9
9
|
static pluralMap: Record<string, ExtractUnit>;
|
|
10
10
|
static extractor(funcName: string): ExtractUnit | undefined;
|
|
11
11
|
constructor(extractText: string, args: ExpressionDef[]);
|
|
12
|
-
|
|
12
|
+
protected computeExpression(fs: FieldSpace): ExprValue;
|
|
13
13
|
}
|
|
@@ -25,7 +25,7 @@ class ExprTimeExtract extends expression_def_1.ExpressionDef {
|
|
|
25
25
|
this.args = args;
|
|
26
26
|
this.elementType = 'timeExtract';
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
computeExpression(fs) {
|
|
29
29
|
const extractTo = ExprTimeExtract.extractor(this.extractText);
|
|
30
30
|
if (extractTo) {
|
|
31
31
|
if (this.args.length !== 1) {
|
|
@@ -6,6 +6,6 @@ export declare class ExprTime extends ExpressionDef {
|
|
|
6
6
|
elementType: string;
|
|
7
7
|
readonly translationValue: ExprValue;
|
|
8
8
|
constructor(timeType: TemporalFieldType, value: Expr, from?: ExprValue[]);
|
|
9
|
-
|
|
9
|
+
protected computeExpression(_fs: FieldSpace): ExprValue;
|
|
10
10
|
static fromValue(timeType: TemporalFieldType, expr: ExprValue): ExprTime;
|
|
11
11
|
}
|
|
@@ -8,5 +8,5 @@ export declare class ExprUngroup extends ExpressionDef {
|
|
|
8
8
|
legalChildTypes: import("../../..").TypeDesc[];
|
|
9
9
|
elementType: string;
|
|
10
10
|
constructor(control: 'all' | 'exclude', expr: ExpressionDef, fields: FieldName[]);
|
|
11
|
-
|
|
11
|
+
protected computeExpression(fs: FieldSpace): ExprValue;
|
|
12
12
|
}
|
|
@@ -52,7 +52,7 @@ class ExprUngroup extends expression_def_1.ExpressionDef {
|
|
|
52
52
|
this.legalChildTypes = TDU.anyAtomicT;
|
|
53
53
|
this.elementType = 'ungroup';
|
|
54
54
|
}
|
|
55
|
-
|
|
55
|
+
computeExpression(fs) {
|
|
56
56
|
var _a;
|
|
57
57
|
const exprVal = this.expr.getExpression(fs);
|
|
58
58
|
if (!(0, malloy_types_1.expressionIsAggregate)(exprVal.expressionType)) {
|
|
@@ -12,5 +12,5 @@ export declare class ForRange extends ExpressionDef {
|
|
|
12
12
|
constructor(from: ExpressionDef, duration: ExpressionDef, timeframe: Timeframe);
|
|
13
13
|
apply(fs: FieldSpace, op: BinaryMalloyOperator, expr: ExpressionDef): ExprValue;
|
|
14
14
|
requestExpression(_fs: FieldSpace): undefined;
|
|
15
|
-
|
|
15
|
+
protected computeExpression(_fs: FieldSpace): ExprValue;
|
|
16
16
|
}
|
|
@@ -110,7 +110,7 @@ class ForRange extends expression_def_1.ExpressionDef {
|
|
|
110
110
|
requestExpression(_fs) {
|
|
111
111
|
return undefined;
|
|
112
112
|
}
|
|
113
|
-
|
|
113
|
+
computeExpression(_fs) {
|
|
114
114
|
return this.loggedErrorExpr('range-as-value', 'A Range is not a value');
|
|
115
115
|
}
|
|
116
116
|
}
|
|
@@ -10,6 +10,6 @@ export declare class PartialCompare extends ExpressionDef {
|
|
|
10
10
|
granular(): boolean;
|
|
11
11
|
apply(fs: FieldSpace, op: string, expr: ExpressionDef): ExprValue;
|
|
12
12
|
requestExpression(_fs: FieldSpace): ExprValue | undefined;
|
|
13
|
-
|
|
13
|
+
protected computeExpression(_fs: FieldSpace): ExprValue;
|
|
14
14
|
atNodeType(): ATNodeType;
|
|
15
15
|
}
|
|
@@ -22,7 +22,7 @@ class PartialCompare extends expression_def_1.ExpressionDef {
|
|
|
22
22
|
requestExpression(_fs) {
|
|
23
23
|
return undefined;
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
computeExpression(_fs) {
|
|
26
26
|
return this.loggedErrorExpr('partial-as-value', 'Partial comparison does not have a value');
|
|
27
27
|
}
|
|
28
28
|
atNodeType() {
|
|
@@ -9,7 +9,7 @@ export declare class Pick extends ExpressionDef {
|
|
|
9
9
|
constructor(choices: PickWhen[], elsePick?: ExpressionDef | undefined);
|
|
10
10
|
requestExpression(fs: FieldSpace): ExprValue | undefined;
|
|
11
11
|
apply(fs: FieldSpace, op: string, expr: ExpressionDef): ExprValue;
|
|
12
|
-
|
|
12
|
+
protected computeExpression(fs: FieldSpace): ExprValue;
|
|
13
13
|
}
|
|
14
14
|
export declare class PickWhen extends MalloyElement {
|
|
15
15
|
readonly pick: ExpressionDef | undefined;
|
|
@@ -9,5 +9,5 @@ export declare class Range extends ExpressionDef {
|
|
|
9
9
|
constructor(first: ExpressionDef, last: ExpressionDef);
|
|
10
10
|
apply(fs: FieldSpace, op: BinaryMalloyOperator, expr: ExpressionDef): ExprValue;
|
|
11
11
|
requestExpression(_fs: FieldSpace): undefined;
|
|
12
|
-
|
|
12
|
+
protected computeExpression(_fs: FieldSpace): ExprValue;
|
|
13
13
|
}
|
|
@@ -56,7 +56,7 @@ class Range extends expression_def_1.ExpressionDef {
|
|
|
56
56
|
requestExpression(_fs) {
|
|
57
57
|
return undefined;
|
|
58
58
|
}
|
|
59
|
-
|
|
59
|
+
computeExpression(_fs) {
|
|
60
60
|
this.logError('range-as-value', 'A Range is not a value');
|
|
61
61
|
return (0, ast_utils_1.errorFor)('a range is not a value');
|
|
62
62
|
}
|
|
@@ -31,7 +31,7 @@ export declare abstract class TimeLiteral extends ExpressionDef {
|
|
|
31
31
|
}) | (import("../../../model").TimestamptzTypeDef & import("../../../model").TypeInfo & import("../types/expr-result").WithValue & {
|
|
32
32
|
timeframe?: TimestampUnit;
|
|
33
33
|
});
|
|
34
|
-
|
|
34
|
+
protected computeExpression(fs: FieldSpace): ExprValue;
|
|
35
35
|
getNext(fs: FieldSpace): ExprValue | undefined;
|
|
36
36
|
granular(): boolean;
|
|
37
37
|
}
|
|
@@ -62,7 +62,7 @@ export declare class LiteralHour extends GranularLiteral {
|
|
|
62
62
|
*/
|
|
63
63
|
declare abstract class DateBasedLiteral extends GranularLiteral {
|
|
64
64
|
constructor(tm: TimeText, units: TimestampUnit, nextLit: string);
|
|
65
|
-
|
|
65
|
+
protected computeExpression(fs: FieldSpace): ExprValue;
|
|
66
66
|
getNext(fs: FieldSpace): ExprValue | undefined;
|
|
67
67
|
}
|
|
68
68
|
export declare class LiteralDay extends DateBasedLiteral {
|
|
@@ -107,7 +107,7 @@ class TimeLiteral extends expression_def_1.ExpressionDef {
|
|
|
107
107
|
timeframe: this.units,
|
|
108
108
|
});
|
|
109
109
|
}
|
|
110
|
-
|
|
110
|
+
computeExpression(fs) {
|
|
111
111
|
return this.makeValue(fs, this.literalPart, this.timeType);
|
|
112
112
|
}
|
|
113
113
|
getNext(fs) {
|
|
@@ -249,7 +249,7 @@ class DateBasedLiteral extends GranularLiteral {
|
|
|
249
249
|
constructor(tm, units, nextLit) {
|
|
250
250
|
super(tm, units, 'date', nextLit);
|
|
251
251
|
}
|
|
252
|
-
|
|
252
|
+
computeExpression(fs) {
|
|
253
253
|
const dateValue = this.makeValue(fs, this.literalPart, 'date');
|
|
254
254
|
const timestamp = this.makeLiteral(fs, `${this.literalPart} 00:00:00`, 'timestamp', this.units);
|
|
255
255
|
return { ...dateValue, morphic: { timestamp }, evalSpace: 'literal' };
|
|
@@ -114,10 +114,17 @@ class DynamicSpace extends static_space_1.StaticSpace {
|
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
this.sourceDef = { ...this.fromSource, fields: [] };
|
|
117
|
-
//
|
|
118
|
-
//
|
|
119
|
-
//
|
|
117
|
+
// A freshly built (modified) source presents a new exported shape, so it
|
|
118
|
+
// is neither a reference to what it was built from nor that source's own
|
|
119
|
+
// definition. Both identities go; `DefineSource` stamps fresh ones if
|
|
120
|
+
// this ends up with a name, and an inline `extend` never does.
|
|
121
|
+
//
|
|
122
|
+
// Dropping `sourceID` also means the persistence walk descends *through*
|
|
123
|
+
// an unnamed modification rather than resolving it by id — which is how
|
|
124
|
+
// an inline `extend` used as a query's structRef stopped hiding the
|
|
125
|
+
// sources it added.
|
|
120
126
|
delete this.sourceDef.referenceID;
|
|
127
|
+
delete this.sourceDef.sourceID;
|
|
121
128
|
this.sourceDef.parameters = parameters;
|
|
122
129
|
const fieldIndices = new Map();
|
|
123
130
|
// Need to process the entities in specific order
|
|
@@ -141,6 +148,16 @@ class DynamicSpace extends static_space_1.StaticSpace {
|
|
|
141
148
|
if (field instanceof join_space_field_1.JoinSpaceField) {
|
|
142
149
|
const joinStruct = field.join.getStructDef(parameterSpace);
|
|
143
150
|
if (!error_factory_1.ErrorFactory.didCreate(joinStruct)) {
|
|
151
|
+
// A query runs on one connection, so everything reachable from
|
|
152
|
+
// the source it runs on must live on that connection. Record and
|
|
153
|
+
// array joins are part of the row, and so have no connection.
|
|
154
|
+
// A base whose schema could not be fetched has the error
|
|
155
|
+
// connection, which is not worth complaining about twice.
|
|
156
|
+
if (model.isSourceDef(joinStruct) &&
|
|
157
|
+
!error_factory_1.ErrorFactory.didCreate(this.fromSource) &&
|
|
158
|
+
joinStruct.connection !== this.connectionName()) {
|
|
159
|
+
field.join.sourceExpr.logError('join-connection-mismatch', `Cannot join '${name}', which is on connection '${joinStruct.connection}', into a source on connection '${this.connectionName()}'`);
|
|
160
|
+
}
|
|
144
161
|
fieldIndices.set(name, this.sourceDef.fields.length);
|
|
145
162
|
this.sourceDef.fields.push(joinStruct);
|
|
146
163
|
field.join.fixupJoinOn(this, joinStruct);
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.ParameterSpace = void 0;
|
|
8
|
+
const field_space_1 = require("../types/field-space");
|
|
8
9
|
const space_param_1 = require("../types/space-param");
|
|
9
10
|
class ParameterSpace {
|
|
10
11
|
constructor(parameters) {
|
|
@@ -80,6 +81,11 @@ class ParameterSpace {
|
|
|
80
81
|
accessProtectionLevel() {
|
|
81
82
|
return 'private';
|
|
82
83
|
}
|
|
84
|
+
// Bindings are fixed by the constructor and never change, so this space
|
|
85
|
+
// contributes no invalidation of its own.
|
|
86
|
+
generation() {
|
|
87
|
+
return (0, field_space_1.currentGeneration)();
|
|
88
|
+
}
|
|
83
89
|
}
|
|
84
90
|
exports.ParameterSpace = ParameterSpace;
|
|
85
91
|
//# sourceMappingURL=parameter-space.js.map
|
|
@@ -18,6 +18,14 @@ export declare class StaticSpace implements FieldSpace {
|
|
|
18
18
|
defToSpaceField(from: FieldDef): SpaceField;
|
|
19
19
|
private get map();
|
|
20
20
|
accessProtectionLevel(): AccessModifierLabel;
|
|
21
|
+
/**
|
|
22
|
+
* StaticSpace itself never rebinds anything after construction, but
|
|
23
|
+
* DynamicSpace extends it and the three mutators below are the whole
|
|
24
|
+
* write surface for both -- `memoMap` is private, and every caller
|
|
25
|
+
* goes through these. That is what makes "every rebinding bumps the
|
|
26
|
+
* generation" checkable rather than a hope.
|
|
27
|
+
*/
|
|
28
|
+
generation(): number;
|
|
21
29
|
protected dropEntries(): void;
|
|
22
30
|
protected dropEntry(name: string): void;
|
|
23
31
|
entry(name: string): SpaceEntry | undefined;
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
exports.StaticSourceSpace = exports.StructSpaceField = exports.StaticSpace = void 0;
|
|
8
8
|
const dialect_map_1 = require("../../../dialect/dialect_map");
|
|
9
9
|
const malloy_types_1 = require("../../../model/malloy_types");
|
|
10
|
+
const field_space_1 = require("../types/field-space");
|
|
10
11
|
const space_param_1 = require("../types/space-param");
|
|
11
12
|
const space_field_1 = require("../types/space-field");
|
|
12
13
|
const struct_space_field_base_1 = require("./struct-space-field-base");
|
|
@@ -64,10 +65,22 @@ class StaticSpace {
|
|
|
64
65
|
accessProtectionLevel() {
|
|
65
66
|
return 'internal';
|
|
66
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* StaticSpace itself never rebinds anything after construction, but
|
|
70
|
+
* DynamicSpace extends it and the three mutators below are the whole
|
|
71
|
+
* write surface for both -- `memoMap` is private, and every caller
|
|
72
|
+
* goes through these. That is what makes "every rebinding bumps the
|
|
73
|
+
* generation" checkable rather than a hope.
|
|
74
|
+
*/
|
|
75
|
+
generation() {
|
|
76
|
+
return (0, field_space_1.currentGeneration)();
|
|
77
|
+
}
|
|
67
78
|
dropEntries() {
|
|
79
|
+
(0, field_space_1.noteRebinding)();
|
|
68
80
|
this.memoMap = new Map();
|
|
69
81
|
}
|
|
70
82
|
dropEntry(name) {
|
|
83
|
+
(0, field_space_1.noteRebinding)();
|
|
71
84
|
this.map.delete(name);
|
|
72
85
|
}
|
|
73
86
|
// TODO this was protected
|
|
@@ -75,6 +88,7 @@ class StaticSpace {
|
|
|
75
88
|
return this.map.get(name);
|
|
76
89
|
}
|
|
77
90
|
setEntry(name, value) {
|
|
91
|
+
(0, field_space_1.noteRebinding)();
|
|
78
92
|
this.map.set(name, value);
|
|
79
93
|
}
|
|
80
94
|
entries() {
|
|
@@ -13,5 +13,5 @@ export declare class QueryArrow extends QueryBase implements QueryElement {
|
|
|
13
13
|
readonly view: View;
|
|
14
14
|
elementType: string;
|
|
15
15
|
constructor(source: Source | QueryElement, view: View);
|
|
16
|
-
queryComp(isRefOk: boolean): QueryComp;
|
|
16
|
+
queryComp(isRefOk: boolean, isPartialOk: boolean): QueryComp;
|
|
17
17
|
}
|
|
@@ -10,6 +10,7 @@ const source_1 = require("../source-elements/source");
|
|
|
10
10
|
const static_space_1 = require("../field-space/static-space");
|
|
11
11
|
const query_base_1 = require("./query-base");
|
|
12
12
|
const composite_source_utils_1 = require("../../composite-source-utils");
|
|
13
|
+
const query_utils_1 = require("../query-utils");
|
|
13
14
|
/**
|
|
14
15
|
* A query operation that adds segments to a LHS source or query.
|
|
15
16
|
*
|
|
@@ -22,7 +23,7 @@ class QueryArrow extends query_base_1.QueryBase {
|
|
|
22
23
|
this.view = view;
|
|
23
24
|
this.elementType = 'arrow';
|
|
24
25
|
}
|
|
25
|
-
queryComp(isRefOk) {
|
|
26
|
+
queryComp(isRefOk, isPartialOk) {
|
|
26
27
|
var _a;
|
|
27
28
|
let inputStruct;
|
|
28
29
|
let queryBase;
|
|
@@ -46,7 +47,9 @@ class QueryArrow extends query_base_1.QueryBase {
|
|
|
46
47
|
}
|
|
47
48
|
else {
|
|
48
49
|
// We are adding a second stage to the given "source" query; we get the query and add a segment
|
|
49
|
-
|
|
50
|
+
// The LHS stages are complete stages, nothing will refine them, so they
|
|
51
|
+
// are never allowed to be partial no matter what this caller accepts.
|
|
52
|
+
const lhsQuery = this.source.queryComp(isRefOk, false);
|
|
50
53
|
queryBase = lhsQuery.query;
|
|
51
54
|
inputStruct = lhsQuery.outputStruct;
|
|
52
55
|
fieldSpace = new static_space_1.StaticSourceSpace(lhsQuery.outputStruct, 'public');
|
|
@@ -77,12 +80,15 @@ class QueryArrow extends query_base_1.QueryBase {
|
|
|
77
80
|
: // Otherwise just use the `inputStruct`
|
|
78
81
|
inputStruct, rhsPipeline),
|
|
79
82
|
];
|
|
83
|
+
const finalPipeline = isPartialOk
|
|
84
|
+
? pipelineWithExpandedFieldUsage
|
|
85
|
+
: (0, query_utils_1.detectAndRemovePartialStages)(pipelineWithExpandedFieldUsage, this);
|
|
80
86
|
return {
|
|
81
87
|
query: {
|
|
82
88
|
...query,
|
|
83
89
|
compositeResolvedSourceDef,
|
|
84
|
-
pipeline:
|
|
85
|
-
givenUsage: (0, composite_source_utils_1.computeQueryGivenUsage)(
|
|
90
|
+
pipeline: finalPipeline,
|
|
91
|
+
givenUsage: (0, composite_source_utils_1.computeQueryGivenUsage)(finalPipeline),
|
|
86
92
|
},
|
|
87
93
|
outputStruct,
|
|
88
94
|
inputStruct,
|
|
@@ -2,7 +2,7 @@ import { type PipeSegment, type Query, type SourceDef } from '../../../model/mal
|
|
|
2
2
|
import { MalloyElement } from '../types/malloy-element';
|
|
3
3
|
import type { QueryComp } from '../types/query-comp';
|
|
4
4
|
export declare abstract class QueryBase extends MalloyElement {
|
|
5
|
-
abstract queryComp(isRefOk: boolean): QueryComp;
|
|
5
|
+
abstract queryComp(isRefOk: boolean, isPartialOk: boolean): QueryComp;
|
|
6
6
|
protected expandRefUsage(inputSource: SourceDef, pipeline: PipeSegment[]): PipeSegment[];
|
|
7
7
|
protected resolveCompositeSource(inputSource: SourceDef, pipeline: PipeSegment[]): SourceDef | undefined;
|
|
8
8
|
query(isRefOk?: boolean): Query;
|
|
@@ -8,7 +8,6 @@ exports.QueryBase = void 0;
|
|
|
8
8
|
const composite_source_utils_1 = require("../../composite-source-utils");
|
|
9
9
|
const malloy_types_1 = require("../../../model/malloy_types");
|
|
10
10
|
const error_factory_1 = require("../error-factory");
|
|
11
|
-
const query_utils_1 = require("../query-utils");
|
|
12
11
|
const malloy_element_1 = require("../types/malloy-element");
|
|
13
12
|
class QueryBase extends malloy_element_1.MalloyElement {
|
|
14
13
|
expandRefUsage(inputSource, pipeline) {
|
|
@@ -40,11 +39,7 @@ class QueryBase extends malloy_element_1.MalloyElement {
|
|
|
40
39
|
return undefined;
|
|
41
40
|
}
|
|
42
41
|
query(isRefOk = true) {
|
|
43
|
-
|
|
44
|
-
return {
|
|
45
|
-
...query,
|
|
46
|
-
pipeline: (0, query_utils_1.detectAndRemovePartialStages)(query.pipeline, this),
|
|
47
|
-
};
|
|
42
|
+
return this.queryComp(isRefOk, false).query;
|
|
48
43
|
}
|
|
49
44
|
}
|
|
50
45
|
exports.QueryBase = QueryBase;
|
|
@@ -15,6 +15,6 @@ export declare class QueryRaw extends MalloyElement implements QueryElement {
|
|
|
15
15
|
readonly source: Source;
|
|
16
16
|
elementType: string;
|
|
17
17
|
constructor(source: Source);
|
|
18
|
-
queryComp(isRefOk: boolean): QueryComp;
|
|
18
|
+
queryComp(isRefOk: boolean, _isPartialOk: boolean): QueryComp;
|
|
19
19
|
query(isRefOk?: boolean): Query;
|
|
20
20
|
}
|