@malloydata/malloy 0.0.391 → 0.0.393
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/asynchronous.js +0 -3
- package/dist/api/foundation/compile.d.ts +1 -1
- package/dist/api/foundation/config.d.ts +80 -8
- package/dist/api/foundation/config.js +151 -69
- package/dist/api/foundation/config_compile.js +27 -35
- package/dist/api/foundation/config_discover.js +5 -9
- package/dist/api/foundation/config_overlays.d.ts +6 -0
- package/dist/api/foundation/config_overlays.js +12 -0
- package/dist/api/foundation/config_resolve.d.ts +4 -1
- package/dist/api/foundation/config_resolve.js +64 -4
- package/dist/api/foundation/core.d.ts +75 -2
- package/dist/api/foundation/core.js +104 -6
- package/dist/api/foundation/index.d.ts +2 -0
- package/dist/api/foundation/readers.js +1 -1
- package/dist/api/foundation/runtime.d.ts +68 -2
- package/dist/api/foundation/runtime.js +212 -10
- package/dist/api/foundation/types.d.ts +2 -1
- package/dist/index.d.ts +3 -1
- package/dist/lang/ast/ast-utils.js +0 -1
- package/dist/lang/ast/expressions/expr-aggregate-function.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-aggregate-function.js +9 -8
- package/dist/lang/ast/expressions/expr-coalesce.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-coalesce.js +2 -3
- package/dist/lang/ast/expressions/expr-count-distinct.js +1 -1
- package/dist/lang/ast/expressions/expr-count.js +6 -4
- package/dist/lang/ast/expressions/expr-filter-expr.js +0 -1
- package/dist/lang/ast/expressions/expr-func.js +9 -4
- package/dist/lang/ast/expressions/expr-given.d.ts +18 -0
- package/dist/lang/ast/expressions/expr-given.js +69 -0
- package/dist/lang/ast/expressions/expr-granular-time.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-id-reference.js +3 -2
- package/dist/lang/ast/expressions/expr-now.js +0 -1
- package/dist/lang/ast/expressions/expr-props.d.ts +132 -132
- package/dist/lang/ast/expressions/expr-props.js +2 -2
- package/dist/lang/ast/expressions/expr-ungroup.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-ungroup.js +4 -4
- package/dist/lang/ast/expressions/for-range.d.ts +1 -1
- package/dist/lang/ast/expressions/function-ordering.d.ts +1 -1
- package/dist/lang/ast/expressions/function-ordering.js +2 -2
- package/dist/lang/ast/expressions/time-literal.d.ts +3 -3
- package/dist/lang/ast/field-space/include-utils.js +2 -2
- package/dist/lang/ast/field-space/index-field-space.js +18 -23
- package/dist/lang/ast/field-space/passthrough-space.d.ts +1 -1
- package/dist/lang/ast/field-space/query-spaces.d.ts +6 -2
- package/dist/lang/ast/field-space/query-spaces.js +29 -19
- package/dist/lang/ast/field-space/reference-field.js +1 -1
- package/dist/lang/ast/field-space/rename-space-field.d.ts +1 -1
- package/dist/lang/ast/field-space/rename-space-field.js +2 -2
- package/dist/lang/ast/field-space/struct-space-field-base.js +2 -3
- package/dist/lang/ast/index.d.ts +2 -0
- package/dist/lang/ast/index.js +2 -0
- package/dist/lang/ast/query-builders/index-builder.d.ts +1 -1
- package/dist/lang/ast/query-builders/index-builder.js +4 -3
- package/dist/lang/ast/query-builders/reduce-builder.d.ts +2 -2
- package/dist/lang/ast/query-builders/reduce-builder.js +4 -5
- package/dist/lang/ast/query-elements/query-arrow.js +3 -2
- package/dist/lang/ast/query-elements/query-base.d.ts +1 -1
- package/dist/lang/ast/query-elements/query-base.js +1 -1
- package/dist/lang/ast/query-elements/query-refine.js +3 -1
- package/dist/lang/ast/query-items/field-declaration.js +2 -2
- package/dist/lang/ast/query-properties/drill.js +6 -6
- package/dist/lang/ast/query-properties/filters.js +2 -2
- package/dist/lang/ast/query-properties/nest.js +3 -3
- package/dist/lang/ast/source-elements/composite-source.js +5 -3
- package/dist/lang/ast/source-elements/named-source.js +4 -0
- package/dist/lang/ast/source-elements/sql-source.js +2 -2
- package/dist/lang/ast/source-elements/table-source.js +3 -1
- package/dist/lang/ast/source-properties/join.js +4 -4
- package/dist/lang/ast/source-query-elements/sq-reference.js +2 -1
- package/dist/lang/ast/statements/define-given.d.ts +23 -0
- package/dist/lang/ast/statements/define-given.js +163 -0
- package/dist/lang/ast/statements/import-statement.js +72 -9
- package/dist/lang/ast/typedesc-utils.d.ts +3 -1
- package/dist/lang/ast/typedesc-utils.js +4 -47
- package/dist/lang/ast/types/expr-value.js +2 -3
- package/dist/lang/ast/types/expression-def.d.ts +2 -2
- package/dist/lang/ast/types/expression-def.js +2 -2
- package/dist/lang/ast/types/malloy-element.d.ts +5 -15
- package/dist/lang/ast/types/malloy-element.js +113 -1
- package/dist/lang/ast/types/space-field.js +7 -9
- package/dist/lang/ast/view-elements/reference-view.js +6 -5
- package/dist/lang/ast/view-elements/refine-utils.js +1 -1
- package/dist/lang/composite-source-utils.d.ts +30 -15
- package/dist/lang/composite-source-utils.js +234 -64
- package/dist/lang/lib/Malloy/MalloyLexer.d.ts +171 -169
- package/dist/lang/lib/Malloy/MalloyLexer.js +1194 -1178
- package/dist/lang/lib/Malloy/MalloyParser.d.ts +408 -334
- package/dist/lang/lib/Malloy/MalloyParser.js +3062 -2561
- package/dist/lang/lib/Malloy/MalloyParserListener.d.ts +68 -0
- package/dist/lang/lib/Malloy/MalloyParserVisitor.d.ts +43 -0
- package/dist/lang/malloy-to-ast.d.ts +13 -1
- package/dist/lang/malloy-to-ast.js +90 -11
- package/dist/lang/parse-log.d.ts +8 -0
- package/dist/lang/prettify/filter-type.d.ts +3 -0
- package/dist/lang/prettify/filter-type.js +38 -0
- package/dist/lang/prettify/formatter.js +6 -0
- package/dist/lang/prettify/inline-renderer.js +20 -0
- package/dist/lang/prettify/rules.d.ts +1 -1
- package/dist/lang/prettify/rules.js +1 -0
- package/dist/lang/prettify/sections.js +2 -0
- package/dist/lang/prettify/tokens.js +2 -0
- package/dist/lang/test/expr-to-str.js +2 -0
- package/dist/lang/test/parse-expects.d.ts +1 -0
- package/dist/lang/test/parse-expects.js +27 -10
- package/dist/model/constant_expression_compiler.js +1 -0
- package/dist/model/expression_compiler.d.ts +2 -1
- package/dist/model/expression_compiler.js +41 -1
- package/dist/model/given_binding.d.ts +2 -0
- package/dist/model/given_binding.js +204 -0
- package/dist/model/index.d.ts +1 -1
- package/dist/model/index.js +2 -1
- package/dist/model/malloy_types.d.ts +163 -36
- package/dist/model/malloy_types.js +97 -0
- package/dist/model/query_model_contract.d.ts +2 -1
- package/dist/model/query_model_impl.d.ts +2 -1
- package/dist/model/query_model_impl.js +7 -0
- package/dist/model/query_node.d.ts +2 -1
- package/dist/model/source_def_utils.d.ts +2 -1
- package/dist/model/source_def_utils.js +4 -0
- package/dist/model/utils.d.ts +14 -1
- package/dist/model/utils.js +41 -0
- package/dist/to_stable.js +1 -1
- package/dist/util/closest_match.d.ts +9 -0
- package/dist/util/closest_match.js +47 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
|
@@ -7,211 +7,211 @@ export declare class ExprProps extends ExpressionDef {
|
|
|
7
7
|
readonly expr: ExpressionDef;
|
|
8
8
|
readonly statements: FieldPropStatement[];
|
|
9
9
|
elementType: string;
|
|
10
|
-
legalChildTypes: import("
|
|
10
|
+
legalChildTypes: import("../../..").TypeDesc[];
|
|
11
11
|
constructor(expr: ExpressionDef, statements: FieldPropStatement[]);
|
|
12
12
|
private getFilteredExpression;
|
|
13
13
|
getExpression(fs: FieldSpace): ExprValue;
|
|
14
14
|
getGroupedBys(fs: FieldSpace, expr: ExprValue, groupedBys: GroupedBy[]): {
|
|
15
|
-
requiresGroupBy: import("../../../model
|
|
15
|
+
requiresGroupBy: import("../../../model").RequiredGroupBy[] | undefined;
|
|
16
16
|
type: "string";
|
|
17
17
|
bucketFilter?: string;
|
|
18
18
|
bucketOther?: string;
|
|
19
|
-
expressionType: import("
|
|
20
|
-
evalSpace: import("../../../model
|
|
21
|
-
|
|
22
|
-
ungroupings?: import("../../../model
|
|
23
|
-
value: import("
|
|
19
|
+
expressionType: import("../../..").ExpressionType;
|
|
20
|
+
evalSpace: import("../../../model").EvalSpace;
|
|
21
|
+
refSummary?: import("../../../model").RefSummary;
|
|
22
|
+
ungroupings?: import("../../../model").AggregateUngrouping[];
|
|
23
|
+
value: import("../../..").Expr;
|
|
24
24
|
morphic?: {
|
|
25
|
-
[x: string]: import("
|
|
25
|
+
[x: string]: import("../../..").Expr;
|
|
26
26
|
};
|
|
27
27
|
} | {
|
|
28
|
-
requiresGroupBy: import("../../../model
|
|
28
|
+
requiresGroupBy: import("../../../model").RequiredGroupBy[] | undefined;
|
|
29
29
|
type: "date";
|
|
30
|
-
timeframe?: import("
|
|
31
|
-
expressionType: import("
|
|
32
|
-
evalSpace: import("../../../model
|
|
33
|
-
|
|
34
|
-
ungroupings?: import("../../../model
|
|
35
|
-
value: import("
|
|
30
|
+
timeframe?: import("../../..").DateUnit;
|
|
31
|
+
expressionType: import("../../..").ExpressionType;
|
|
32
|
+
evalSpace: import("../../../model").EvalSpace;
|
|
33
|
+
refSummary?: import("../../../model").RefSummary;
|
|
34
|
+
ungroupings?: import("../../../model").AggregateUngrouping[];
|
|
35
|
+
value: import("../../..").Expr;
|
|
36
36
|
morphic?: {
|
|
37
|
-
[x: string]: import("
|
|
37
|
+
[x: string]: import("../../..").Expr;
|
|
38
38
|
};
|
|
39
39
|
} | {
|
|
40
|
-
requiresGroupBy: import("../../../model
|
|
40
|
+
requiresGroupBy: import("../../../model").RequiredGroupBy[] | undefined;
|
|
41
41
|
type: "timestamp";
|
|
42
|
-
timeframe?: import("
|
|
43
|
-
expressionType: import("
|
|
44
|
-
evalSpace: import("../../../model
|
|
45
|
-
|
|
46
|
-
ungroupings?: import("../../../model
|
|
47
|
-
value: import("
|
|
42
|
+
timeframe?: import("../../..").TimestampUnit;
|
|
43
|
+
expressionType: import("../../..").ExpressionType;
|
|
44
|
+
evalSpace: import("../../../model").EvalSpace;
|
|
45
|
+
refSummary?: import("../../../model").RefSummary;
|
|
46
|
+
ungroupings?: import("../../../model").AggregateUngrouping[];
|
|
47
|
+
value: import("../../..").Expr;
|
|
48
48
|
morphic?: {
|
|
49
|
-
[x: string]: import("
|
|
49
|
+
[x: string]: import("../../..").Expr;
|
|
50
50
|
};
|
|
51
51
|
} | {
|
|
52
|
-
requiresGroupBy: import("../../../model
|
|
52
|
+
requiresGroupBy: import("../../../model").RequiredGroupBy[] | undefined;
|
|
53
53
|
type: "timestamptz";
|
|
54
|
-
timeframe?: import("
|
|
55
|
-
expressionType: import("
|
|
56
|
-
evalSpace: import("../../../model
|
|
57
|
-
|
|
58
|
-
ungroupings?: import("../../../model
|
|
59
|
-
value: import("
|
|
54
|
+
timeframe?: import("../../..").TimestampUnit;
|
|
55
|
+
expressionType: import("../../..").ExpressionType;
|
|
56
|
+
evalSpace: import("../../../model").EvalSpace;
|
|
57
|
+
refSummary?: import("../../../model").RefSummary;
|
|
58
|
+
ungroupings?: import("../../../model").AggregateUngrouping[];
|
|
59
|
+
value: import("../../..").Expr;
|
|
60
60
|
morphic?: {
|
|
61
|
-
[x: string]: import("
|
|
61
|
+
[x: string]: import("../../..").Expr;
|
|
62
62
|
};
|
|
63
63
|
} | {
|
|
64
|
-
requiresGroupBy: import("../../../model
|
|
64
|
+
requiresGroupBy: import("../../../model").RequiredGroupBy[] | undefined;
|
|
65
65
|
type: "number";
|
|
66
66
|
numberType?: "integer" | "float" | "bigint";
|
|
67
|
-
expressionType: import("
|
|
68
|
-
evalSpace: import("../../../model
|
|
69
|
-
|
|
70
|
-
ungroupings?: import("../../../model
|
|
71
|
-
value: import("
|
|
67
|
+
expressionType: import("../../..").ExpressionType;
|
|
68
|
+
evalSpace: import("../../../model").EvalSpace;
|
|
69
|
+
refSummary?: import("../../../model").RefSummary;
|
|
70
|
+
ungroupings?: import("../../../model").AggregateUngrouping[];
|
|
71
|
+
value: import("../../..").Expr;
|
|
72
72
|
morphic?: {
|
|
73
|
-
[x: string]: import("
|
|
73
|
+
[x: string]: import("../../..").Expr;
|
|
74
74
|
};
|
|
75
75
|
} | {
|
|
76
|
-
requiresGroupBy: import("../../../model
|
|
76
|
+
requiresGroupBy: import("../../../model").RequiredGroupBy[] | undefined;
|
|
77
77
|
type: "boolean";
|
|
78
|
-
expressionType: import("
|
|
79
|
-
evalSpace: import("../../../model
|
|
80
|
-
|
|
81
|
-
ungroupings?: import("../../../model
|
|
82
|
-
value: import("
|
|
78
|
+
expressionType: import("../../..").ExpressionType;
|
|
79
|
+
evalSpace: import("../../../model").EvalSpace;
|
|
80
|
+
refSummary?: import("../../../model").RefSummary;
|
|
81
|
+
ungroupings?: import("../../../model").AggregateUngrouping[];
|
|
82
|
+
value: import("../../..").Expr;
|
|
83
83
|
morphic?: {
|
|
84
|
-
[x: string]: import("
|
|
84
|
+
[x: string]: import("../../..").Expr;
|
|
85
85
|
};
|
|
86
86
|
} | {
|
|
87
|
-
requiresGroupBy: import("../../../model
|
|
87
|
+
requiresGroupBy: import("../../../model").RequiredGroupBy[] | undefined;
|
|
88
88
|
type: "json";
|
|
89
|
-
expressionType: import("
|
|
90
|
-
evalSpace: import("../../../model
|
|
91
|
-
|
|
92
|
-
ungroupings?: import("../../../model
|
|
93
|
-
value: import("
|
|
89
|
+
expressionType: import("../../..").ExpressionType;
|
|
90
|
+
evalSpace: import("../../../model").EvalSpace;
|
|
91
|
+
refSummary?: import("../../../model").RefSummary;
|
|
92
|
+
ungroupings?: import("../../../model").AggregateUngrouping[];
|
|
93
|
+
value: import("../../..").Expr;
|
|
94
94
|
morphic?: {
|
|
95
|
-
[x: string]: import("
|
|
95
|
+
[x: string]: import("../../..").Expr;
|
|
96
96
|
};
|
|
97
97
|
} | {
|
|
98
|
-
requiresGroupBy: import("../../../model
|
|
98
|
+
requiresGroupBy: import("../../../model").RequiredGroupBy[] | undefined;
|
|
99
99
|
type: "sql native";
|
|
100
100
|
rawType?: string;
|
|
101
|
-
expressionType: import("
|
|
102
|
-
evalSpace: import("../../../model
|
|
103
|
-
|
|
104
|
-
ungroupings?: import("../../../model
|
|
105
|
-
value: import("
|
|
101
|
+
expressionType: import("../../..").ExpressionType;
|
|
102
|
+
evalSpace: import("../../../model").EvalSpace;
|
|
103
|
+
refSummary?: import("../../../model").RefSummary;
|
|
104
|
+
ungroupings?: import("../../../model").AggregateUngrouping[];
|
|
105
|
+
value: import("../../..").Expr;
|
|
106
106
|
morphic?: {
|
|
107
|
-
[x: string]: import("
|
|
107
|
+
[x: string]: import("../../..").Expr;
|
|
108
108
|
};
|
|
109
109
|
} | {
|
|
110
|
-
requiresGroupBy: import("../../../model
|
|
110
|
+
requiresGroupBy: import("../../../model").RequiredGroupBy[] | undefined;
|
|
111
111
|
type: "error";
|
|
112
|
-
expressionType: import("
|
|
113
|
-
evalSpace: import("../../../model
|
|
114
|
-
|
|
115
|
-
ungroupings?: import("../../../model
|
|
116
|
-
value: import("
|
|
112
|
+
expressionType: import("../../..").ExpressionType;
|
|
113
|
+
evalSpace: import("../../../model").EvalSpace;
|
|
114
|
+
refSummary?: import("../../../model").RefSummary;
|
|
115
|
+
ungroupings?: import("../../../model").AggregateUngrouping[];
|
|
116
|
+
value: import("../../..").Expr;
|
|
117
117
|
morphic?: {
|
|
118
|
-
[x: string]: import("
|
|
118
|
+
[x: string]: import("../../..").Expr;
|
|
119
119
|
};
|
|
120
120
|
} | {
|
|
121
|
-
requiresGroupBy: import("../../../model
|
|
121
|
+
requiresGroupBy: import("../../../model").RequiredGroupBy[] | undefined;
|
|
122
122
|
type: "array";
|
|
123
|
-
elementTypeDef: Exclude<import("
|
|
124
|
-
expressionType: import("
|
|
125
|
-
evalSpace: import("../../../model
|
|
126
|
-
|
|
127
|
-
ungroupings?: import("../../../model
|
|
128
|
-
value: import("
|
|
123
|
+
elementTypeDef: Exclude<import("../../..").AtomicTypeDef, import("../../..").RecordTypeDef>;
|
|
124
|
+
expressionType: import("../../..").ExpressionType;
|
|
125
|
+
evalSpace: import("../../../model").EvalSpace;
|
|
126
|
+
refSummary?: import("../../../model").RefSummary;
|
|
127
|
+
ungroupings?: import("../../../model").AggregateUngrouping[];
|
|
128
|
+
value: import("../../..").Expr;
|
|
129
129
|
morphic?: {
|
|
130
|
-
[x: string]: import("
|
|
130
|
+
[x: string]: import("../../..").Expr;
|
|
131
131
|
};
|
|
132
132
|
} | {
|
|
133
|
-
requiresGroupBy: import("../../../model
|
|
133
|
+
requiresGroupBy: import("../../../model").RequiredGroupBy[] | undefined;
|
|
134
134
|
type: "record";
|
|
135
|
-
fields: import("
|
|
136
|
-
expressionType: import("
|
|
137
|
-
evalSpace: import("../../../model
|
|
138
|
-
|
|
139
|
-
ungroupings?: import("../../../model
|
|
140
|
-
value: import("
|
|
135
|
+
fields: import("../../..").FieldDef[];
|
|
136
|
+
expressionType: import("../../..").ExpressionType;
|
|
137
|
+
evalSpace: import("../../../model").EvalSpace;
|
|
138
|
+
refSummary?: import("../../../model").RefSummary;
|
|
139
|
+
ungroupings?: import("../../../model").AggregateUngrouping[];
|
|
140
|
+
value: import("../../..").Expr;
|
|
141
141
|
morphic?: {
|
|
142
|
-
[x: string]: import("
|
|
142
|
+
[x: string]: import("../../..").Expr;
|
|
143
143
|
};
|
|
144
144
|
} | {
|
|
145
|
-
requiresGroupBy: import("../../../model
|
|
145
|
+
requiresGroupBy: import("../../../model").RequiredGroupBy[] | undefined;
|
|
146
146
|
type: "array";
|
|
147
|
-
elementTypeDef: import("../../../model
|
|
148
|
-
fields: import("
|
|
149
|
-
expressionType: import("
|
|
150
|
-
evalSpace: import("../../../model
|
|
151
|
-
|
|
152
|
-
ungroupings?: import("../../../model
|
|
153
|
-
value: import("
|
|
147
|
+
elementTypeDef: import("../../../model").RecordElementTypeDef;
|
|
148
|
+
fields: import("../../..").FieldDef[];
|
|
149
|
+
expressionType: import("../../..").ExpressionType;
|
|
150
|
+
evalSpace: import("../../../model").EvalSpace;
|
|
151
|
+
refSummary?: import("../../../model").RefSummary;
|
|
152
|
+
ungroupings?: import("../../../model").AggregateUngrouping[];
|
|
153
|
+
value: import("../../..").Expr;
|
|
154
154
|
morphic?: {
|
|
155
|
-
[x: string]: import("
|
|
155
|
+
[x: string]: import("../../..").Expr;
|
|
156
156
|
};
|
|
157
157
|
} | {
|
|
158
|
-
requiresGroupBy: import("../../../model
|
|
159
|
-
type: import("../../../model
|
|
160
|
-
expressionType: import("
|
|
161
|
-
evalSpace: import("../../../model
|
|
162
|
-
|
|
163
|
-
ungroupings?: import("../../../model
|
|
164
|
-
value: import("
|
|
158
|
+
requiresGroupBy: import("../../../model").RequiredGroupBy[] | undefined;
|
|
159
|
+
type: import("../../../model").NonAtomicType;
|
|
160
|
+
expressionType: import("../../..").ExpressionType;
|
|
161
|
+
evalSpace: import("../../../model").EvalSpace;
|
|
162
|
+
refSummary?: import("../../../model").RefSummary;
|
|
163
|
+
ungroupings?: import("../../../model").AggregateUngrouping[];
|
|
164
|
+
value: import("../../..").Expr;
|
|
165
165
|
morphic?: {
|
|
166
|
-
[x: string]: import("
|
|
166
|
+
[x: string]: import("../../..").Expr;
|
|
167
167
|
};
|
|
168
168
|
} | {
|
|
169
|
-
requiresGroupBy: import("../../../model
|
|
169
|
+
requiresGroupBy: import("../../../model").RequiredGroupBy[] | undefined;
|
|
170
170
|
type: "turtle";
|
|
171
|
-
pipeline: import("
|
|
172
|
-
expressionType: import("
|
|
173
|
-
evalSpace: import("../../../model
|
|
174
|
-
|
|
175
|
-
ungroupings?: import("../../../model
|
|
176
|
-
value: import("
|
|
171
|
+
pipeline: import("../../..").PipeSegment[];
|
|
172
|
+
expressionType: import("../../..").ExpressionType;
|
|
173
|
+
evalSpace: import("../../../model").EvalSpace;
|
|
174
|
+
refSummary?: import("../../../model").RefSummary;
|
|
175
|
+
ungroupings?: import("../../../model").AggregateUngrouping[];
|
|
176
|
+
value: import("../../..").Expr;
|
|
177
177
|
morphic?: {
|
|
178
|
-
[x: string]: import("
|
|
178
|
+
[x: string]: import("../../..").Expr;
|
|
179
179
|
};
|
|
180
180
|
} | {
|
|
181
|
-
requiresGroupBy: import("../../../model
|
|
181
|
+
requiresGroupBy: import("../../../model").RequiredGroupBy[] | undefined;
|
|
182
182
|
type: "date";
|
|
183
183
|
timeframe?: "day" | "week" | "month" | "quarter" | "year" | undefined;
|
|
184
|
-
expressionType: import("
|
|
185
|
-
evalSpace: import("../../../model
|
|
186
|
-
|
|
187
|
-
ungroupings?: import("../../../model
|
|
188
|
-
value: import("
|
|
184
|
+
expressionType: import("../../..").ExpressionType;
|
|
185
|
+
evalSpace: import("../../../model").EvalSpace;
|
|
186
|
+
refSummary?: import("../../../model").RefSummary;
|
|
187
|
+
ungroupings?: import("../../../model").AggregateUngrouping[];
|
|
188
|
+
value: import("../../..").Expr;
|
|
189
189
|
morphic?: {
|
|
190
|
-
[x: string]: import("
|
|
190
|
+
[x: string]: import("../../..").Expr;
|
|
191
191
|
};
|
|
192
192
|
} | {
|
|
193
|
-
requiresGroupBy: import("../../../model
|
|
193
|
+
requiresGroupBy: import("../../../model").RequiredGroupBy[] | undefined;
|
|
194
194
|
type: "timestamp";
|
|
195
|
-
timeframe?: import("
|
|
196
|
-
expressionType: import("
|
|
197
|
-
evalSpace: import("../../../model
|
|
198
|
-
|
|
199
|
-
ungroupings?: import("../../../model
|
|
200
|
-
value: import("
|
|
195
|
+
timeframe?: import("../../..").TimestampUnit;
|
|
196
|
+
expressionType: import("../../..").ExpressionType;
|
|
197
|
+
evalSpace: import("../../../model").EvalSpace;
|
|
198
|
+
refSummary?: import("../../../model").RefSummary;
|
|
199
|
+
ungroupings?: import("../../../model").AggregateUngrouping[];
|
|
200
|
+
value: import("../../..").Expr;
|
|
201
201
|
morphic?: {
|
|
202
|
-
[x: string]: import("
|
|
202
|
+
[x: string]: import("../../..").Expr;
|
|
203
203
|
};
|
|
204
204
|
} | {
|
|
205
|
-
requiresGroupBy: import("../../../model
|
|
205
|
+
requiresGroupBy: import("../../../model").RequiredGroupBy[] | undefined;
|
|
206
206
|
type: "timestamptz";
|
|
207
|
-
timeframe?: import("
|
|
208
|
-
expressionType: import("
|
|
209
|
-
evalSpace: import("../../../model
|
|
210
|
-
|
|
211
|
-
ungroupings?: import("../../../model
|
|
212
|
-
value: import("
|
|
213
|
-
morphic?: {
|
|
214
|
-
[x: string]: import("
|
|
207
|
+
timeframe?: import("../../..").TimestampUnit;
|
|
208
|
+
expressionType: import("../../..").ExpressionType;
|
|
209
|
+
evalSpace: import("../../../model").EvalSpace;
|
|
210
|
+
refSummary?: import("../../../model").RefSummary;
|
|
211
|
+
ungroupings?: import("../../../model").AggregateUngrouping[];
|
|
212
|
+
value: import("../../..").Expr;
|
|
213
|
+
morphic?: {
|
|
214
|
+
[x: string]: import("../../..").Expr;
|
|
215
215
|
};
|
|
216
216
|
};
|
|
217
217
|
}
|
|
@@ -57,6 +57,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
57
57
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
58
58
|
exports.ExprProps = void 0;
|
|
59
59
|
const malloy_types_1 = require("../../../model/malloy_types");
|
|
60
|
+
const composite_source_utils_1 = require("../../composite-source-utils");
|
|
60
61
|
const ast_utils_1 = require("../ast-utils");
|
|
61
62
|
const TDU = __importStar(require("../typedesc-utils"));
|
|
62
63
|
const function_ordering_1 = require("./function-ordering");
|
|
@@ -65,7 +66,6 @@ const partition_by_1 = require("./partition_by");
|
|
|
65
66
|
const expr_value_1 = require("../types/expr-value");
|
|
66
67
|
const expression_def_1 = require("../types/expression-def");
|
|
67
68
|
const expr_func_1 = require("./expr-func");
|
|
68
|
-
const composite_source_utils_1 = require("../../composite-source-utils");
|
|
69
69
|
const grouped_by_1 = require("./grouped_by");
|
|
70
70
|
class ExprProps extends expression_def_1.ExpressionDef {
|
|
71
71
|
constructor(expr, statements) {
|
|
@@ -93,7 +93,7 @@ class ExprProps extends expression_def_1.ExpressionDef {
|
|
|
93
93
|
if (this.typeCheck(this.expr, { ...expr, expressionType: 'scalar' })) {
|
|
94
94
|
return {
|
|
95
95
|
...expr,
|
|
96
|
-
|
|
96
|
+
refSummary: (0, composite_source_utils_1.mergeRefSummaries)(expr.refSummary, ...filterList.map(f => f.refSummary)),
|
|
97
97
|
value: {
|
|
98
98
|
node: 'filteredExpr',
|
|
99
99
|
kids: { e: expr.value, filterList },
|
|
@@ -5,7 +5,7 @@ export declare class ExprUngroup extends ExpressionDef {
|
|
|
5
5
|
readonly control: 'all' | 'exclude';
|
|
6
6
|
readonly expr: ExpressionDef;
|
|
7
7
|
readonly fields: FieldName[];
|
|
8
|
-
legalChildTypes: import("
|
|
8
|
+
legalChildTypes: import("../../..").TypeDesc[];
|
|
9
9
|
elementType: string;
|
|
10
10
|
constructor(control: 'all' | 'exclude', expr: ExpressionDef, fields: FieldName[]);
|
|
11
11
|
getExpression(fs: FieldSpace): ExprValue;
|
|
@@ -117,18 +117,18 @@ class ExprUngroup extends expression_def_1.ExpressionDef {
|
|
|
117
117
|
}
|
|
118
118
|
ungroup.fields = dstFields;
|
|
119
119
|
}
|
|
120
|
-
const fieldUsage = exprVal.
|
|
120
|
+
const fieldUsage = (0, malloy_types_1.fieldUsageFrom)(exprVal.refSummary);
|
|
121
121
|
return {
|
|
122
122
|
...TDU.atomicDef(exprVal),
|
|
123
123
|
expressionType: 'ungrouped_aggregate',
|
|
124
124
|
value: ungroup,
|
|
125
125
|
evalSpace: 'output',
|
|
126
|
-
|
|
126
|
+
refSummary: exprVal.refSummary,
|
|
127
127
|
ungroupings: [
|
|
128
128
|
{
|
|
129
129
|
requiresGroupBy: (_a = exprVal.requiresGroupBy) !== null && _a !== void 0 ? _a : [],
|
|
130
|
-
fieldUsage
|
|
131
|
-
ungroupedFields: isExclude ? ungroupFields !== null && ungroupFields !== void 0 ? ungroupFields : [] : '*',
|
|
130
|
+
fieldUsage,
|
|
131
|
+
ungroupedFields: isExclude ? (ungroupFields !== null && ungroupFields !== void 0 ? ungroupFields : []) : '*',
|
|
132
132
|
path: [],
|
|
133
133
|
exclude: isExclude,
|
|
134
134
|
refFields: ungroup.fields,
|
|
@@ -8,7 +8,7 @@ export declare class ForRange extends ExpressionDef {
|
|
|
8
8
|
readonly duration: ExpressionDef;
|
|
9
9
|
readonly timeframe: Timeframe;
|
|
10
10
|
elementType: string;
|
|
11
|
-
legalChildTypes: import("
|
|
11
|
+
legalChildTypes: import("../../..").TypeDesc[];
|
|
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;
|
|
@@ -2,7 +2,7 @@ import type { FieldUsage, FunctionOrderBy as ModelFunctionOrderBy } from '../../
|
|
|
2
2
|
import type { ExpressionDef } from '../types/expression-def';
|
|
3
3
|
import type { FieldSpace } from '../types/field-space';
|
|
4
4
|
import { ListOf, MalloyElement } from '../types/malloy-element';
|
|
5
|
-
type FieldUsageSummary = FieldUsage
|
|
5
|
+
type FieldUsageSummary = FieldUsage | undefined;
|
|
6
6
|
export declare class FunctionOrderBy extends MalloyElement {
|
|
7
7
|
readonly field?: ExpressionDef | undefined;
|
|
8
8
|
readonly dir?: "asc" | "desc" | undefined;
|
|
@@ -50,7 +50,7 @@ class FunctionOrderBy extends malloy_element_1.MalloyElement {
|
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
52
|
const expr = this.field.getExpression(fs);
|
|
53
|
-
fieldUsage = expr.
|
|
53
|
+
fieldUsage = (0, malloy_types_1.fieldUsageFrom)(expr.refSummary);
|
|
54
54
|
if ((0, malloy_types_1.expressionIsAggregate)(expr.expressionType)) {
|
|
55
55
|
// Aggregates are okay
|
|
56
56
|
}
|
|
@@ -77,7 +77,7 @@ class FunctionOrderBy extends malloy_element_1.MalloyElement {
|
|
|
77
77
|
const dir = this.dir || 'asc';
|
|
78
78
|
if (this.field) {
|
|
79
79
|
const expr = this.field.getExpression(fs);
|
|
80
|
-
fieldUsage = expr.
|
|
80
|
+
fieldUsage = (0, malloy_types_1.fieldUsageFrom)(expr.refSummary);
|
|
81
81
|
if (!(0, malloy_types_1.expressionIsScalar)(expr.expressionType)) {
|
|
82
82
|
this.field.logError('aggregate-order-by-not-scalar', 'aggregate `order_by` must be scalar');
|
|
83
83
|
}
|
|
@@ -24,11 +24,11 @@ export declare abstract class TimeLiteral extends ExpressionDef {
|
|
|
24
24
|
protected makeLiteral(fs: FieldSpace, val: string, typ: TemporalFieldType, units: TimestampUnit | undefined): TimeLiteralExpr;
|
|
25
25
|
protected makeValue(fs: FieldSpace, val: string, dataType: TemporalFieldType): TimeResult;
|
|
26
26
|
getStableLiteral(): Malloy.LiteralValue;
|
|
27
|
-
getValue(): (import("../../../model
|
|
27
|
+
getValue(): (import("../../../model").DateTypeDef & import("../../../model").TypeInfo & import("../types/expr-result").WithValue & {
|
|
28
28
|
timeframe?: TimestampUnit;
|
|
29
|
-
}) | (import("../../../model
|
|
29
|
+
}) | (import("../../../model").TimestampTypeDef & import("../../../model").TypeInfo & import("../types/expr-result").WithValue & {
|
|
30
30
|
timeframe?: TimestampUnit;
|
|
31
|
-
}) | (import("../../../model
|
|
31
|
+
}) | (import("../../../model").TimestamptzTypeDef & import("../../../model").TypeInfo & import("../types/expr-result").WithValue & {
|
|
32
32
|
timeframe?: TimestampUnit;
|
|
33
33
|
});
|
|
34
34
|
getExpression(fs: FieldSpace): ExprValue;
|
|
@@ -105,7 +105,7 @@ function processIncludeList(includeItems, from) {
|
|
|
105
105
|
if (item instanceof include_item_1.IncludeAccessItem) {
|
|
106
106
|
for (const f of item.fields) {
|
|
107
107
|
const joinPath = f.name instanceof field_references_1.WildcardFieldReference
|
|
108
|
-
? (_b = (_a = f.name.joinPath) === null || _a === void 0 ? void 0 : _a.path) !== null && _b !== void 0 ? _b : []
|
|
108
|
+
? ((_b = (_a = f.name.joinPath) === null || _a === void 0 ? void 0 : _a.path) !== null && _b !== void 0 ? _b : [])
|
|
109
109
|
: f.name.path.slice(0, -1);
|
|
110
110
|
const joinState = getOrCreateIncludeStateForJoin(joinPath, state, from, f);
|
|
111
111
|
checkParents(state, joinPath, from, f, item.kind);
|
|
@@ -179,7 +179,7 @@ function processIncludeList(includeItems, from) {
|
|
|
179
179
|
else if (item instanceof include_item_1.IncludeExceptItem) {
|
|
180
180
|
for (const f of item.fields) {
|
|
181
181
|
const joinPath = f instanceof field_references_1.WildcardFieldReference
|
|
182
|
-
? (_p = (_o = f.joinPath) === null || _o === void 0 ? void 0 : _o.path) !== null && _p !== void 0 ? _p : []
|
|
182
|
+
? ((_p = (_o = f.joinPath) === null || _o === void 0 ? void 0 : _o.path) !== null && _p !== void 0 ? _p : [])
|
|
183
183
|
: f.path.slice(0, -1);
|
|
184
184
|
const joinState = getOrCreateIncludeStateForJoin(joinPath, state, from, f);
|
|
185
185
|
checkParents(state, joinPath, from, f, item.kind);
|
|
@@ -66,39 +66,34 @@ class IndexFieldSpace extends query_spaces_1.QueryOperationSpace {
|
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
68
|
getPipeSegment(refineIndex) {
|
|
69
|
-
var _a;
|
|
70
69
|
if (refineIndex) {
|
|
71
70
|
this.logError('refinement-of-index-segment', 'index query operations cannot be refined');
|
|
72
71
|
return error_factory_1.ErrorFactory.indexSegment;
|
|
73
72
|
}
|
|
74
|
-
let fieldUsage = (0, composite_source_utils_1.emptyFieldUsage)();
|
|
75
73
|
const indexFields = [];
|
|
74
|
+
let refSummary = undefined;
|
|
76
75
|
for (const [name, field] of this.entries()) {
|
|
77
|
-
if (field instanceof space_field_1.SpaceField)
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
76
|
+
if (!(field instanceof space_field_1.SpaceField))
|
|
77
|
+
continue;
|
|
78
|
+
const wild = this.expandedWild.get(name);
|
|
79
|
+
if (wild) {
|
|
80
|
+
indexFields.push({ type: 'fieldref', path: wild.path, at: wild.at });
|
|
81
|
+
refSummary = (0, composite_source_utils_1.mergeRefSummaries)(refSummary, { fieldUsage: [{ path: wild.path }] }, wild.entry.typeDesc().refSummary);
|
|
82
|
+
}
|
|
83
|
+
else if (field instanceof reference_field_1.ReferenceField) {
|
|
84
|
+
// attempt to cause a type check
|
|
85
|
+
const fieldRef = field.fieldRef;
|
|
86
|
+
const check = fieldRef.getField(this.exprSpace);
|
|
87
|
+
if (check.error) {
|
|
88
|
+
fieldRef.logError(check.error.code, check.error.message);
|
|
84
89
|
}
|
|
85
|
-
else
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
const check = fieldRef.getField(this.exprSpace);
|
|
89
|
-
if (check.error) {
|
|
90
|
-
fieldRef.logError(check.error.code, check.error.message);
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
indexFields.push(fieldRef.refToField);
|
|
94
|
-
nextFieldUsage = check.found.typeDesc().fieldUsage;
|
|
95
|
-
fieldUsage.push({ path: fieldRef.path });
|
|
96
|
-
}
|
|
90
|
+
else {
|
|
91
|
+
indexFields.push(fieldRef.refToField);
|
|
92
|
+
refSummary = (0, composite_source_utils_1.mergeRefSummaries)(refSummary, { fieldUsage: [{ path: fieldRef.path }] }, check.found.typeDesc().refSummary);
|
|
97
93
|
}
|
|
98
|
-
fieldUsage = (_a = (0, composite_source_utils_1.mergeFieldUsage)(fieldUsage, nextFieldUsage)) !== null && _a !== void 0 ? _a : [];
|
|
99
94
|
}
|
|
100
95
|
}
|
|
101
|
-
this.
|
|
96
|
+
this.refSummary = refSummary;
|
|
102
97
|
const outputStruct = this.structDef();
|
|
103
98
|
return { type: 'index', indexFields, outputStruct };
|
|
104
99
|
}
|
|
@@ -16,7 +16,7 @@ export declare class PassthroughSpace implements FieldSpace {
|
|
|
16
16
|
dialectObj(): Dialect | undefined;
|
|
17
17
|
isQueryFieldSpace(): this is QueryFieldSpace;
|
|
18
18
|
outputSpace(): import("./query-spaces").QueryOperationSpace;
|
|
19
|
-
inputSpace(): import("
|
|
19
|
+
inputSpace(): import("..").SourceFieldSpace;
|
|
20
20
|
accessProtectionLevel(): AccessModifierLabel;
|
|
21
21
|
connectionName(): string;
|
|
22
22
|
}
|
|
@@ -43,8 +43,12 @@ export declare abstract class QueryOperationSpace extends RefinedSpace implement
|
|
|
43
43
|
name: string;
|
|
44
44
|
field: SpaceField;
|
|
45
45
|
})[];
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
private _refSummary;
|
|
47
|
+
private _refSummaryComputed;
|
|
48
|
+
get refSummary(): model.RefSummary | undefined;
|
|
49
|
+
protected set refSummary(rs: model.RefSummary | undefined);
|
|
50
|
+
get fieldUsage(): model.FieldUsage;
|
|
51
|
+
get givenUsage(): model.GivenUsage;
|
|
48
52
|
constructor(queryInputSpace: SourceFieldSpace, refineThis: model.PipeSegment | undefined, nestParent: QueryOperationSpace | undefined, astEl: MalloyElement);
|
|
49
53
|
abstract addRefineFromFields(refineThis: model.PipeSegment): void;
|
|
50
54
|
logError<T extends MessageCode>(code: T, parameters: MessageParameterType<T>, options?: Omit<LogMessageOptions, 'severity'>): T;
|