@malloydata/malloy 0.0.22-dev230207182613 → 0.0.22-dev230207183024
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/connection_utils.js +7 -7
- package/dist/dialect/dialect.d.ts +1 -1
- package/dist/dialect/duckdb.d.ts +1 -1
- package/dist/dialect/duckdb.js +9 -9
- package/dist/dialect/postgres.d.ts +1 -1
- package/dist/dialect/postgres.js +16 -16
- package/dist/dialect/standardsql.d.ts +1 -1
- package/dist/dialect/standardsql.js +8 -8
- package/dist/index.d.ts +6 -6
- package/dist/lang/ast/ast-utils.js +3 -3
- package/dist/lang/ast/elements/define-query.js +4 -4
- package/dist/lang/ast/elements/define-source.d.ts +1 -1
- package/dist/lang/ast/elements/define-source.js +8 -8
- package/dist/lang/ast/elements/import-statement.js +2 -2
- package/dist/lang/ast/elements/pipeline-desc.d.ts +1 -1
- package/dist/lang/ast/elements/pipeline-desc.js +7 -7
- package/dist/lang/ast/elements/refined-source.d.ts +1 -1
- package/dist/lang/ast/elements/refined-source.js +5 -5
- package/dist/lang/ast/elements/source.js +1 -1
- package/dist/lang/ast/error-factory.js +16 -13
- package/dist/lang/ast/expressions/binary-boolean.d.ts +1 -1
- package/dist/lang/ast/expressions/binary-boolean.js +4 -4
- package/dist/lang/ast/expressions/binary-numeric.d.ts +1 -1
- package/dist/lang/ast/expressions/binary-numeric.js +1 -1
- package/dist/lang/ast/expressions/boolean.js +1 -1
- package/dist/lang/ast/expressions/constant-sub-expression.js +7 -7
- package/dist/lang/ast/expressions/expr-aggregate-function.d.ts +3 -3
- package/dist/lang/ast/expressions/expr-aggregate-function.js +12 -12
- package/dist/lang/ast/expressions/expr-alternation-tree.js +3 -3
- package/dist/lang/ast/expressions/expr-asymmetric.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-asymmetric.js +1 -1
- package/dist/lang/ast/expressions/expr-avg.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-avg.js +1 -1
- package/dist/lang/ast/expressions/expr-cast.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-cast.js +26 -4
- package/dist/lang/ast/expressions/expr-compare.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-compare.js +3 -3
- package/dist/lang/ast/expressions/expr-count.js +6 -6
- package/dist/lang/ast/expressions/expr-filter.d.ts +2 -2
- package/dist/lang/ast/expressions/expr-filter.js +8 -8
- package/dist/lang/ast/expressions/expr-func.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-func.js +3 -3
- package/dist/lang/ast/expressions/expr-granular-time.js +7 -7
- package/dist/lang/ast/expressions/expr-id-reference.js +11 -11
- package/dist/lang/ast/expressions/expr-logical-op.js +1 -1
- package/dist/lang/ast/expressions/expr-minus.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-minus.js +3 -3
- package/dist/lang/ast/expressions/expr-not.js +2 -2
- package/dist/lang/ast/expressions/expr-now.js +7 -7
- package/dist/lang/ast/expressions/expr-null.js +3 -3
- package/dist/lang/ast/expressions/expr-number.js +1 -1
- package/dist/lang/ast/expressions/expr-parens.js +2 -2
- package/dist/lang/ast/expressions/expr-regex.js +3 -3
- package/dist/lang/ast/expressions/expr-string.js +6 -6
- package/dist/lang/ast/expressions/expr-sum.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-sum.js +1 -1
- package/dist/lang/ast/expressions/expr-time-extract.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-time-extract.js +29 -29
- package/dist/lang/ast/expressions/expr-time.js +7 -7
- package/dist/lang/ast/expressions/expr-ungroup.d.ts +2 -2
- package/dist/lang/ast/expressions/expr-ungroup.js +11 -8
- package/dist/lang/ast/expressions/for-range.d.ts +1 -1
- package/dist/lang/ast/expressions/for-range.js +1 -1
- package/dist/lang/ast/expressions/granular-literal.js +12 -12
- package/dist/lang/ast/expressions/partial-compare.d.ts +1 -1
- package/dist/lang/ast/expressions/partial-compare.js +1 -1
- package/dist/lang/ast/expressions/pick-when.d.ts +1 -1
- package/dist/lang/ast/expressions/pick-when.js +11 -11
- package/dist/lang/ast/expressions/range.js +4 -4
- package/dist/lang/ast/expressions/top-by.d.ts +1 -1
- package/dist/lang/ast/expressions/top-by.js +4 -4
- package/dist/lang/ast/expressions/unary.js +1 -1
- package/dist/lang/ast/field-space/dynamic-space.d.ts +1 -1
- package/dist/lang/ast/field-space/dynamic-space.js +1 -1
- package/dist/lang/ast/field-space/index-field-space.js +2 -2
- package/dist/lang/ast/field-space/query-field-struct.js +1 -1
- package/dist/lang/ast/field-space/query-space-field.js +1 -1
- package/dist/lang/ast/field-space/query-spaces.js +2 -2
- package/dist/lang/ast/field-space/reference-field.js +1 -1
- package/dist/lang/ast/field-space/rename-space-field.js +2 -2
- package/dist/lang/ast/field-space/static-space.js +8 -8
- package/dist/lang/ast/field-space/struct-space-field-base.js +1 -1
- package/dist/lang/ast/fragtype-utils.js +2 -2
- package/dist/lang/ast/parameters/constant-parameter.js +9 -9
- package/dist/lang/ast/parameters/has-parameter.js +5 -5
- package/dist/lang/ast/query-elements/anonymous-query.js +1 -1
- package/dist/lang/ast/query-elements/existing-query.d.ts +1 -1
- package/dist/lang/ast/query-elements/existing-query.js +11 -11
- package/dist/lang/ast/query-elements/full-query.js +11 -11
- package/dist/lang/ast/query-elements/query-head-struct.js +1 -1
- package/dist/lang/ast/query-items/field-declaration.d.ts +1 -1
- package/dist/lang/ast/query-items/field-declaration.js +11 -11
- package/dist/lang/ast/query-items/field-references.d.ts +1 -1
- package/dist/lang/ast/query-items/field-references.js +1 -1
- package/dist/lang/ast/query-properties/filters.d.ts +1 -1
- package/dist/lang/ast/query-properties/filters.js +7 -7
- package/dist/lang/ast/query-properties/indexing.d.ts +1 -1
- package/dist/lang/ast/query-properties/indexing.js +2 -2
- package/dist/lang/ast/query-properties/joins.d.ts +1 -1
- package/dist/lang/ast/query-properties/joins.js +17 -14
- package/dist/lang/ast/query-properties/nest.js +4 -4
- package/dist/lang/ast/query-properties/ordering.js +2 -2
- package/dist/lang/ast/query-properties/qop-desc.js +1 -1
- package/dist/lang/ast/query-properties/top.js +3 -3
- package/dist/lang/ast/source-properties/field-list-edit.js +1 -1
- package/dist/lang/ast/source-properties/primary-key.js +1 -1
- package/dist/lang/ast/source-properties/renames.js +1 -1
- package/dist/lang/ast/sources/named-source.d.ts +2 -2
- package/dist/lang/ast/sources/named-source.js +6 -6
- package/dist/lang/ast/sources/query-source.d.ts +1 -1
- package/dist/lang/ast/sources/query-source.js +2 -2
- package/dist/lang/ast/sources/table-source.js +7 -5
- package/dist/lang/ast/space-seed.d.ts +1 -1
- package/dist/lang/ast/sql-elements/sql-statement.js +5 -5
- package/dist/lang/ast/sql-elements/sql-string.js +1 -1
- package/dist/lang/ast/struct-utils.js +2 -2
- package/dist/lang/ast/time-utils.js +32 -32
- package/dist/lang/ast/types/expression-def.js +34 -34
- package/dist/lang/ast/types/malloy-element.d.ts +4 -4
- package/dist/lang/ast/types/malloy-element.js +27 -27
- package/dist/lang/ast/types/query-comp.d.ts +1 -1
- package/dist/lang/ast/types/space-field.js +1 -1
- package/dist/lang/ast/types/space-param.js +2 -2
- package/dist/lang/ast/types/turtle-headed-pipe.d.ts +1 -1
- package/dist/lang/ast/types/turtle-headed-pipe.js +1 -1
- package/dist/lang/ast/types/type-desc.d.ts +1 -1
- package/dist/lang/field-utils.d.ts +1 -1
- package/dist/lang/index.d.ts +1 -1
- package/dist/lang/malloy-to-ast.d.ts +1 -1
- package/dist/lang/malloy-to-ast.js +11 -11
- package/dist/lang/parse-error-handler.js +4 -4
- package/dist/lang/parse-malloy.d.ts +4 -4
- package/dist/lang/parse-malloy.js +61 -61
- package/dist/lang/parse-tree-walkers/document-completion-walker.js +16 -16
- package/dist/lang/parse-tree-walkers/document-help-context-walker.js +10 -10
- package/dist/lang/parse-tree-walkers/document-highlight-walker.js +85 -82
- package/dist/lang/parse-tree-walkers/document-symbol-walker.js +40 -40
- package/dist/lang/parse-tree-walkers/find-external-references.d.ts +1 -1
- package/dist/lang/parse-tree-walkers/find-external-references.js +2 -2
- package/dist/lang/reference-list.d.ts +1 -1
- package/dist/lang/test/document-help-context-walker.spec.js +6 -6
- package/dist/lang/test/document-symbol-walker.spec.js +3 -3
- package/dist/lang/test/field-symbols.spec.js +62 -58
- package/dist/lang/test/parse.spec.js +262 -260
- package/dist/lang/test/test-translator.d.ts +1 -1
- package/dist/lang/test/test-translator.js +139 -139
- package/dist/lang/translate-response.d.ts +1 -1
- package/dist/lang/zone.js +5 -5
- package/dist/malloy.d.ts +5 -5
- package/dist/malloy.js +72 -72
- package/dist/model/malloy_query.d.ts +2 -2
- package/dist/model/malloy_query.js +179 -176
- package/dist/model/malloy_types.js +41 -41
- package/dist/model/sql_block.js +2 -2
- package/package.json +1 -1
|
@@ -39,26 +39,26 @@ class DocumentSymbolWalker {
|
|
|
39
39
|
}
|
|
40
40
|
enterTopLevelQueryDef(pcx) {
|
|
41
41
|
this.symbols.push({
|
|
42
|
-
range: this.translator.rangeFromContext(pcx),
|
|
43
|
-
name: pcx.queryName().text,
|
|
44
|
-
type: "query",
|
|
45
|
-
children: []
|
|
42
|
+
"range": this.translator.rangeFromContext(pcx),
|
|
43
|
+
"name": pcx.queryName().text,
|
|
44
|
+
"type": "query",
|
|
45
|
+
"children": []
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
48
|
enterTopLevelAnonQueryDef(pcx) {
|
|
49
49
|
this.symbols.push({
|
|
50
|
-
range: this.translator.rangeFromContext(pcx),
|
|
51
|
-
name: "unnamed_query",
|
|
52
|
-
type: "unnamed_query",
|
|
53
|
-
children: []
|
|
50
|
+
"range": this.translator.rangeFromContext(pcx),
|
|
51
|
+
"name": "unnamed_query",
|
|
52
|
+
"type": "unnamed_query",
|
|
53
|
+
"children": []
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
56
|
enterSourceDefinition(pcx) {
|
|
57
57
|
this.scopes.push({
|
|
58
|
-
range: this.translator.rangeFromContext(pcx),
|
|
59
|
-
name: pcx.sourceNameDef().id().text,
|
|
60
|
-
type: "explore",
|
|
61
|
-
children: []
|
|
58
|
+
"range": this.translator.rangeFromContext(pcx),
|
|
59
|
+
"name": pcx.sourceNameDef().id().text,
|
|
60
|
+
"type": "explore",
|
|
61
|
+
"children": []
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
64
|
exitSourceDefinition(_pcx) {
|
|
@@ -69,10 +69,10 @@ class DocumentSymbolWalker {
|
|
|
69
69
|
}
|
|
70
70
|
enterExploreQueryDef(pcx) {
|
|
71
71
|
const symbol = {
|
|
72
|
-
range: this.translator.rangeFromContext(pcx),
|
|
73
|
-
name: pcx.exploreQueryNameDef().id().text,
|
|
74
|
-
type: "query",
|
|
75
|
-
children: []
|
|
72
|
+
"range": this.translator.rangeFromContext(pcx),
|
|
73
|
+
"name": pcx.exploreQueryNameDef().id().text,
|
|
74
|
+
"type": "query",
|
|
75
|
+
"children": []
|
|
76
76
|
};
|
|
77
77
|
const parent = this.peekScope();
|
|
78
78
|
if (parent) {
|
|
@@ -85,10 +85,10 @@ class DocumentSymbolWalker {
|
|
|
85
85
|
}
|
|
86
86
|
handleNestEntry(pcx) {
|
|
87
87
|
const symbol = {
|
|
88
|
-
range: this.translator.rangeFromContext(pcx),
|
|
89
|
-
name: pcx.queryName().id().text,
|
|
90
|
-
type: "query",
|
|
91
|
-
children: []
|
|
88
|
+
"range": this.translator.rangeFromContext(pcx),
|
|
89
|
+
"name": pcx.queryName().id().text,
|
|
90
|
+
"type": "query",
|
|
91
|
+
"children": []
|
|
92
92
|
};
|
|
93
93
|
const parent = this.peekScope();
|
|
94
94
|
if (parent) {
|
|
@@ -108,10 +108,10 @@ class DocumentSymbolWalker {
|
|
|
108
108
|
}
|
|
109
109
|
enterFieldDef(pcx) {
|
|
110
110
|
const symbol = {
|
|
111
|
-
range: this.translator.rangeFromContext(pcx),
|
|
112
|
-
name: pcx.fieldNameDef().id().text,
|
|
113
|
-
type: "field",
|
|
114
|
-
children: []
|
|
111
|
+
"range": this.translator.rangeFromContext(pcx),
|
|
112
|
+
"name": pcx.fieldNameDef().id().text,
|
|
113
|
+
"type": "field",
|
|
114
|
+
"children": []
|
|
115
115
|
};
|
|
116
116
|
const parent = this.peekScope();
|
|
117
117
|
if (parent) {
|
|
@@ -120,10 +120,10 @@ class DocumentSymbolWalker {
|
|
|
120
120
|
}
|
|
121
121
|
enterQueryFieldRef(pcx) {
|
|
122
122
|
const symbol = {
|
|
123
|
-
range: this.translator.rangeFromContext(pcx),
|
|
124
|
-
name: pcx.fieldPath().text,
|
|
125
|
-
type: "field",
|
|
126
|
-
children: []
|
|
123
|
+
"range": this.translator.rangeFromContext(pcx),
|
|
124
|
+
"name": pcx.fieldPath().text,
|
|
125
|
+
"type": "field",
|
|
126
|
+
"children": []
|
|
127
127
|
};
|
|
128
128
|
const parent = this.peekScope();
|
|
129
129
|
if (parent) {
|
|
@@ -132,10 +132,10 @@ class DocumentSymbolWalker {
|
|
|
132
132
|
}
|
|
133
133
|
enterExploreRenameDef(pcx) {
|
|
134
134
|
const symbol = {
|
|
135
|
-
range: this.translator.rangeFromContext(pcx),
|
|
136
|
-
name: pcx.fieldName()[0].text,
|
|
137
|
-
type: "field",
|
|
138
|
-
children: []
|
|
135
|
+
"range": this.translator.rangeFromContext(pcx),
|
|
136
|
+
"name": pcx.fieldName()[0].text,
|
|
137
|
+
"type": "field",
|
|
138
|
+
"children": []
|
|
139
139
|
};
|
|
140
140
|
const parent = this.peekScope();
|
|
141
141
|
if (parent) {
|
|
@@ -150,10 +150,10 @@ class DocumentSymbolWalker {
|
|
|
150
150
|
}
|
|
151
151
|
handleJoinDef(pcx) {
|
|
152
152
|
const symbol = {
|
|
153
|
-
range: this.translator.rangeFromContext(pcx),
|
|
154
|
-
name: pcx.joinNameDef().id().text,
|
|
155
|
-
type: "join",
|
|
156
|
-
children: []
|
|
153
|
+
"range": this.translator.rangeFromContext(pcx),
|
|
154
|
+
"name": pcx.joinNameDef().id().text,
|
|
155
|
+
"type": "join",
|
|
156
|
+
"children": []
|
|
157
157
|
};
|
|
158
158
|
const parent = this.peekScope();
|
|
159
159
|
if (parent) {
|
|
@@ -164,10 +164,10 @@ class DocumentSymbolWalker {
|
|
|
164
164
|
var _a;
|
|
165
165
|
const name = (_a = pcx.nameSQLBlock()) === null || _a === void 0 ? void 0 : _a.text;
|
|
166
166
|
const symbol = {
|
|
167
|
-
range: this.translator.rangeFromContext(pcx),
|
|
168
|
-
name: name || "unnamed_sql",
|
|
169
|
-
type: name === undefined ? "unnamed_sql" : "sql",
|
|
170
|
-
children: []
|
|
167
|
+
"range": this.translator.rangeFromContext(pcx),
|
|
168
|
+
"name": name || "unnamed_sql",
|
|
169
|
+
"type": name === undefined ? "unnamed_sql" : "sql",
|
|
170
|
+
"children": []
|
|
171
171
|
};
|
|
172
172
|
this.symbols.push(symbol);
|
|
173
173
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CommonTokenStream } from "antlr4ts";
|
|
2
|
-
import
|
|
2
|
+
import { ParseTree } from "antlr4ts/tree";
|
|
3
3
|
import { DocumentRange } from "../../model/malloy_types";
|
|
4
4
|
import { MalloyTranslation } from "../parse-malloy";
|
|
5
5
|
declare type References = Record<string, DocumentRange>;
|
|
@@ -50,10 +50,10 @@ function findReferences(trans, tokens, parseTree) {
|
|
|
50
50
|
ParseTreeWalker_1.ParseTreeWalker.DEFAULT.walk(listener, parseTree);
|
|
51
51
|
let refs = {};
|
|
52
52
|
if (Object.keys(finder.needTables).length > 0) {
|
|
53
|
-
refs = { tables: finder.needTables };
|
|
53
|
+
refs = { "tables": finder.needTables };
|
|
54
54
|
}
|
|
55
55
|
if (Object.keys(finder.needImports).length > 0) {
|
|
56
|
-
refs = { ...refs, urls: finder.needImports };
|
|
56
|
+
refs = { ...refs, "urls": finder.needImports };
|
|
57
57
|
}
|
|
58
58
|
return Object.keys(refs).length > 0 ? refs : null;
|
|
59
59
|
}
|
|
@@ -41,15 +41,15 @@ query: bar {
|
|
|
41
41
|
group_by: bazz
|
|
42
42
|
}`;
|
|
43
43
|
test("Supports model properties", () => {
|
|
44
|
-
testHelpContext((0, test_translator_1.markSource) `${source}`, { line: 0, character: 1 }, "model_property", "source:");
|
|
45
|
-
testHelpContext((0, test_translator_1.markSource) `${source}`, { line: 8, character: 1 }, "model_property", "query:");
|
|
44
|
+
testHelpContext((0, test_translator_1.markSource) `${source}`, { "line": 0, "character": 1 }, "model_property", "source:");
|
|
45
|
+
testHelpContext((0, test_translator_1.markSource) `${source}`, { "line": 8, "character": 1 }, "model_property", "query:");
|
|
46
46
|
});
|
|
47
47
|
test("Supports explore properties", () => {
|
|
48
|
-
testHelpContext((0, test_translator_1.markSource) `${source}`, { line: 1, character: 3 }, "explore_property", "where:");
|
|
49
|
-
testHelpContext((0, test_translator_1.markSource) `${source}`, { line: 2, character: 3 }, "explore_property", "query:");
|
|
48
|
+
testHelpContext((0, test_translator_1.markSource) `${source}`, { "line": 1, "character": 3 }, "explore_property", "where:");
|
|
49
|
+
testHelpContext((0, test_translator_1.markSource) `${source}`, { "line": 2, "character": 3 }, "explore_property", "query:");
|
|
50
50
|
});
|
|
51
51
|
test("Supports query properties", () => {
|
|
52
|
-
testHelpContext((0, test_translator_1.markSource) `${source}`, { line: 3, character: 5 }, "query_property", "group_by:");
|
|
53
|
-
testHelpContext((0, test_translator_1.markSource) `${source}`, { line: 4, character: 5 }, "query_property", "where:");
|
|
52
|
+
testHelpContext((0, test_translator_1.markSource) `${source}`, { "line": 3, "character": 5 }, "query_property", "group_by:");
|
|
53
|
+
testHelpContext((0, test_translator_1.markSource) `${source}`, { "line": 4, "character": 5 }, "query_property", "where:");
|
|
54
54
|
});
|
|
55
55
|
//# sourceMappingURL=document-help-context-walker.spec.js.map
|
|
@@ -34,15 +34,15 @@ class MalloyExplore extends test_translator_1.TestTranslator {
|
|
|
34
34
|
}
|
|
35
35
|
function testSymbol(source, name, type, path) {
|
|
36
36
|
const doc = new MalloyExplore(source.code);
|
|
37
|
-
let current = { children: doc.symbols };
|
|
37
|
+
let current = { "children": doc.symbols };
|
|
38
38
|
path.forEach((segment) => {
|
|
39
39
|
current = current.children[segment];
|
|
40
40
|
});
|
|
41
41
|
expect(doc.logger.hasErrors()).toBeFalsy();
|
|
42
42
|
expect(current).toMatchObject({
|
|
43
43
|
name,
|
|
44
|
-
range: source.locations[0].range,
|
|
45
|
-
type
|
|
44
|
+
"range": source.locations[0].range,
|
|
45
|
+
type
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
48
|
test("explore symbols are included", () => {
|
|
@@ -34,12 +34,12 @@ const space_param_1 = require("../ast/types/space-param");
|
|
|
34
34
|
describe("structdef comprehension", () => {
|
|
35
35
|
function mkStructDef(field) {
|
|
36
36
|
return {
|
|
37
|
-
type: "struct",
|
|
38
|
-
name: "test",
|
|
39
|
-
dialect: "standardsql",
|
|
40
|
-
structSource: { type: "table", tablePath: "test" },
|
|
41
|
-
structRelationship: { type: "basetable", connectionName: "test" },
|
|
42
|
-
fields: [field]
|
|
37
|
+
"type": "struct",
|
|
38
|
+
"name": "test",
|
|
39
|
+
"dialect": "standardsql",
|
|
40
|
+
"structSource": { "type": "table", "tablePath": "test" },
|
|
41
|
+
"structRelationship": { "type": "basetable", "connectionName": "test" },
|
|
42
|
+
"fields": [field]
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
45
|
function fieldRef(fieldPath) {
|
|
@@ -47,8 +47,8 @@ describe("structdef comprehension", () => {
|
|
|
47
47
|
}
|
|
48
48
|
test(`import string field`, () => {
|
|
49
49
|
const field = {
|
|
50
|
-
name: "t",
|
|
51
|
-
type: "string"
|
|
50
|
+
"name": "t",
|
|
51
|
+
"type": "string"
|
|
52
52
|
};
|
|
53
53
|
const struct = mkStructDef(field);
|
|
54
54
|
const space = new static_space_1.StaticSpace(struct);
|
|
@@ -58,9 +58,9 @@ describe("structdef comprehension", () => {
|
|
|
58
58
|
});
|
|
59
59
|
test(`import float field`, () => {
|
|
60
60
|
const field = {
|
|
61
|
-
name: "t",
|
|
62
|
-
type: "number",
|
|
63
|
-
numberType: "float"
|
|
61
|
+
"name": "t",
|
|
62
|
+
"type": "number",
|
|
63
|
+
"numberType": "float"
|
|
64
64
|
};
|
|
65
65
|
const struct = mkStructDef(field);
|
|
66
66
|
const space = new static_space_1.StaticSpace(struct);
|
|
@@ -70,9 +70,9 @@ describe("structdef comprehension", () => {
|
|
|
70
70
|
});
|
|
71
71
|
test(`import integer field`, () => {
|
|
72
72
|
const field = {
|
|
73
|
-
name: "t",
|
|
74
|
-
type: "number",
|
|
75
|
-
numberType: "integer"
|
|
73
|
+
"name": "t",
|
|
74
|
+
"type": "number",
|
|
75
|
+
"numberType": "integer"
|
|
76
76
|
};
|
|
77
77
|
const struct = mkStructDef(field);
|
|
78
78
|
const space = new static_space_1.StaticSpace(struct);
|
|
@@ -82,8 +82,8 @@ describe("structdef comprehension", () => {
|
|
|
82
82
|
});
|
|
83
83
|
test(`import boolean field`, () => {
|
|
84
84
|
const field = {
|
|
85
|
-
name: "t",
|
|
86
|
-
type: "boolean"
|
|
85
|
+
"name": "t",
|
|
86
|
+
"type": "boolean"
|
|
87
87
|
};
|
|
88
88
|
const struct = mkStructDef(field);
|
|
89
89
|
const space = new static_space_1.StaticSpace(struct);
|
|
@@ -93,12 +93,16 @@ describe("structdef comprehension", () => {
|
|
|
93
93
|
});
|
|
94
94
|
test(`import nested field`, () => {
|
|
95
95
|
const field = {
|
|
96
|
-
name: "t",
|
|
97
|
-
type: "struct",
|
|
98
|
-
dialect: "standardsql",
|
|
99
|
-
structRelationship: {
|
|
100
|
-
|
|
101
|
-
|
|
96
|
+
"name": "t",
|
|
97
|
+
"type": "struct",
|
|
98
|
+
"dialect": "standardsql",
|
|
99
|
+
"structRelationship": {
|
|
100
|
+
"type": "nested",
|
|
101
|
+
"field": "a",
|
|
102
|
+
"isArray": false
|
|
103
|
+
},
|
|
104
|
+
"structSource": { "type": "nested" },
|
|
105
|
+
"fields": [{ "type": "string", "name": "b" }]
|
|
102
106
|
};
|
|
103
107
|
const struct = mkStructDef(field);
|
|
104
108
|
const space = new static_space_1.StaticSpace(struct);
|
|
@@ -108,12 +112,12 @@ describe("structdef comprehension", () => {
|
|
|
108
112
|
});
|
|
109
113
|
test(`import inline field`, () => {
|
|
110
114
|
const field = {
|
|
111
|
-
name: "t",
|
|
112
|
-
type: "struct",
|
|
113
|
-
dialect: "standardsql",
|
|
114
|
-
structRelationship: { type: "inline" },
|
|
115
|
-
structSource: { type: "inline" },
|
|
116
|
-
fields: [{ type: "string", name: "a" }]
|
|
115
|
+
"name": "t",
|
|
116
|
+
"type": "struct",
|
|
117
|
+
"dialect": "standardsql",
|
|
118
|
+
"structRelationship": { "type": "inline" },
|
|
119
|
+
"structSource": { "type": "inline" },
|
|
120
|
+
"fields": [{ "type": "string", "name": "a" }]
|
|
117
121
|
};
|
|
118
122
|
const struct = mkStructDef(field);
|
|
119
123
|
const space = new static_space_1.StaticSpace(struct);
|
|
@@ -123,19 +127,19 @@ describe("structdef comprehension", () => {
|
|
|
123
127
|
});
|
|
124
128
|
test(`import join field`, () => {
|
|
125
129
|
const field = {
|
|
126
|
-
name: "t",
|
|
127
|
-
type: "struct",
|
|
128
|
-
dialect: "standardsql",
|
|
129
|
-
structRelationship: {
|
|
130
|
-
type: "one",
|
|
131
|
-
onExpression: [
|
|
132
|
-
{ type: "field", path: "aKey" },
|
|
130
|
+
"name": "t",
|
|
131
|
+
"type": "struct",
|
|
132
|
+
"dialect": "standardsql",
|
|
133
|
+
"structRelationship": {
|
|
134
|
+
"type": "one",
|
|
135
|
+
"onExpression": [
|
|
136
|
+
{ "type": "field", "path": "aKey" },
|
|
133
137
|
"=",
|
|
134
|
-
{ type: "field", path: "t.a" }
|
|
135
|
-
]
|
|
138
|
+
{ "type": "field", "path": "t.a" }
|
|
139
|
+
]
|
|
136
140
|
},
|
|
137
|
-
structSource: { type: "table", tablePath: "t" },
|
|
138
|
-
fields: [{ type: "string", name: "a" }]
|
|
141
|
+
"structSource": { "type": "table", "tablePath": "t" },
|
|
142
|
+
"fields": [{ "type": "string", "name": "a" }]
|
|
139
143
|
};
|
|
140
144
|
const struct = mkStructDef(field);
|
|
141
145
|
const space = new static_space_1.StaticSpace(struct);
|
|
@@ -145,14 +149,14 @@ describe("structdef comprehension", () => {
|
|
|
145
149
|
});
|
|
146
150
|
test(`import query stage field`, () => {
|
|
147
151
|
const field = {
|
|
148
|
-
name: "t",
|
|
149
|
-
type: "turtle",
|
|
150
|
-
pipeline: [
|
|
152
|
+
"name": "t",
|
|
153
|
+
"type": "turtle",
|
|
154
|
+
"pipeline": [
|
|
151
155
|
{
|
|
152
|
-
type: "reduce",
|
|
153
|
-
fields: ["a"]
|
|
154
|
-
}
|
|
155
|
-
]
|
|
156
|
+
"type": "reduce",
|
|
157
|
+
"fields": ["a"]
|
|
158
|
+
}
|
|
159
|
+
]
|
|
156
160
|
};
|
|
157
161
|
const struct = mkStructDef(field);
|
|
158
162
|
const space = new static_space_1.StaticSpace(struct);
|
|
@@ -161,20 +165,20 @@ describe("structdef comprehension", () => {
|
|
|
161
165
|
expect(oField).toEqual(field);
|
|
162
166
|
});
|
|
163
167
|
test("import struct with parameters", () => {
|
|
164
|
-
const struct = mkStructDef({ name: "f", type: "string" });
|
|
168
|
+
const struct = mkStructDef({ "name": "f", "type": "string" });
|
|
165
169
|
struct.parameters = {
|
|
166
|
-
cReqStr: {
|
|
167
|
-
name: "cReqStr",
|
|
168
|
-
type: "string",
|
|
169
|
-
value: null,
|
|
170
|
-
constant: false
|
|
171
|
-
},
|
|
172
|
-
cOptStr: {
|
|
173
|
-
name: "cOptStr",
|
|
174
|
-
type: "string",
|
|
175
|
-
value: ["value"],
|
|
176
|
-
constant: false,
|
|
170
|
+
"cReqStr": {
|
|
171
|
+
"name": "cReqStr",
|
|
172
|
+
"type": "string",
|
|
173
|
+
"value": null,
|
|
174
|
+
"constant": false
|
|
177
175
|
},
|
|
176
|
+
"cOptStr": {
|
|
177
|
+
"name": "cOptStr",
|
|
178
|
+
"type": "string",
|
|
179
|
+
"value": ["value"],
|
|
180
|
+
"constant": false
|
|
181
|
+
}
|
|
178
182
|
};
|
|
179
183
|
const space = new static_space_1.StaticSpace(struct);
|
|
180
184
|
expect(space.lookup(fieldRef("cReqStr")).found).toBeInstanceOf(space_param_1.DefinedParameter);
|