@malloydata/malloy 0.0.24-dev230224214106 → 0.0.24-dev230228224434
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 +10 -10
- package/dist/dialect/dialect.d.ts +2 -2
- package/dist/dialect/dialect.js +13 -13
- package/dist/dialect/dialect_map.d.ts +1 -1
- package/dist/dialect/duckdb.d.ts +3 -3
- package/dist/dialect/duckdb.js +44 -44
- package/dist/dialect/index.d.ts +6 -6
- package/dist/dialect/postgres.d.ts +3 -3
- package/dist/dialect/postgres.js +46 -46
- package/dist/dialect/standardsql.d.ts +4 -4
- package/dist/dialect/standardsql.js +51 -51
- package/dist/index.d.ts +10 -10
- package/dist/lang/ast/ast-utils.d.ts +1 -1
- package/dist/lang/ast/ast-utils.js +3 -3
- package/dist/lang/ast/elements/define-query.d.ts +3 -3
- package/dist/lang/ast/elements/define-query.js +6 -6
- package/dist/lang/ast/elements/define-source.d.ts +4 -4
- package/dist/lang/ast/elements/define-source.js +8 -8
- package/dist/lang/ast/elements/import-statement.d.ts +2 -2
- package/dist/lang/ast/elements/import-statement.js +7 -7
- package/dist/lang/ast/elements/pipeline-desc.d.ts +5 -5
- package/dist/lang/ast/elements/pipeline-desc.js +11 -11
- package/dist/lang/ast/elements/refined-source.d.ts +4 -4
- package/dist/lang/ast/elements/refined-source.js +6 -6
- package/dist/lang/ast/elements/source.d.ts +3 -3
- package/dist/lang/ast/elements/source.js +1 -1
- package/dist/lang/ast/error-factory.d.ts +1 -1
- package/dist/lang/ast/error-factory.js +15 -15
- package/dist/lang/ast/executors/index-executor.d.ts +7 -7
- package/dist/lang/ast/executors/index-executor.js +4 -4
- package/dist/lang/ast/executors/project-executor.d.ts +5 -5
- package/dist/lang/ast/executors/project-executor.js +2 -2
- package/dist/lang/ast/executors/reduce-executor.d.ts +8 -8
- package/dist/lang/ast/executors/reduce-executor.js +5 -5
- package/dist/lang/ast/expressions/apply.d.ts +2 -2
- package/dist/lang/ast/expressions/apply.js +1 -1
- package/dist/lang/ast/expressions/binary-boolean.d.ts +3 -3
- package/dist/lang/ast/expressions/binary-boolean.js +6 -6
- package/dist/lang/ast/expressions/binary-numeric.d.ts +3 -3
- package/dist/lang/ast/expressions/binary-numeric.js +2 -2
- package/dist/lang/ast/expressions/boolean.d.ts +4 -4
- package/dist/lang/ast/expressions/boolean.js +2 -2
- package/dist/lang/ast/expressions/constant-sub-expression.d.ts +4 -4
- package/dist/lang/ast/expressions/constant-sub-expression.js +12 -12
- package/dist/lang/ast/expressions/expr-add-sub.d.ts +2 -2
- package/dist/lang/ast/expressions/expr-add-sub.js +1 -1
- package/dist/lang/ast/expressions/expr-aggregate-function.d.ts +5 -5
- package/dist/lang/ast/expressions/expr-aggregate-function.js +15 -15
- package/dist/lang/ast/expressions/expr-alternation-tree.d.ts +6 -6
- package/dist/lang/ast/expressions/expr-alternation-tree.js +6 -6
- package/dist/lang/ast/expressions/expr-asymmetric.d.ts +5 -5
- package/dist/lang/ast/expressions/expr-asymmetric.js +3 -3
- package/dist/lang/ast/expressions/expr-avg.d.ts +3 -3
- package/dist/lang/ast/expressions/expr-avg.js +2 -2
- package/dist/lang/ast/expressions/expr-cast.d.ts +4 -4
- package/dist/lang/ast/expressions/expr-cast.js +6 -6
- package/dist/lang/ast/expressions/expr-compare.d.ts +5 -5
- package/dist/lang/ast/expressions/expr-compare.js +9 -9
- package/dist/lang/ast/expressions/expr-count-distinct.d.ts +2 -2
- package/dist/lang/ast/expressions/expr-count-distinct.js +1 -1
- package/dist/lang/ast/expressions/expr-count.d.ts +4 -4
- package/dist/lang/ast/expressions/expr-count.js +10 -10
- package/dist/lang/ast/expressions/expr-filter.d.ts +4 -4
- package/dist/lang/ast/expressions/expr-filter.js +13 -13
- package/dist/lang/ast/expressions/expr-func.d.ts +3 -3
- package/dist/lang/ast/expressions/expr-func.js +8 -8
- package/dist/lang/ast/expressions/expr-granular-time.d.ts +4 -4
- package/dist/lang/ast/expressions/expr-granular-time.js +17 -17
- package/dist/lang/ast/expressions/expr-id-reference.d.ts +4 -4
- package/dist/lang/ast/expressions/expr-id-reference.js +11 -11
- package/dist/lang/ast/expressions/expr-logical-op.d.ts +2 -2
- package/dist/lang/ast/expressions/expr-logical-op.js +1 -1
- package/dist/lang/ast/expressions/expr-max.d.ts +4 -4
- package/dist/lang/ast/expressions/expr-max.js +1 -1
- package/dist/lang/ast/expressions/expr-min.d.ts +4 -4
- package/dist/lang/ast/expressions/expr-min.js +1 -1
- package/dist/lang/ast/expressions/expr-minus.d.ts +3 -3
- package/dist/lang/ast/expressions/expr-minus.js +5 -5
- package/dist/lang/ast/expressions/expr-mul-div.d.ts +2 -2
- package/dist/lang/ast/expressions/expr-mul-div.js +1 -1
- package/dist/lang/ast/expressions/expr-not.d.ts +4 -4
- package/dist/lang/ast/expressions/expr-not.js +3 -3
- package/dist/lang/ast/expressions/expr-now.d.ts +3 -3
- package/dist/lang/ast/expressions/expr-now.js +8 -8
- package/dist/lang/ast/expressions/expr-null.d.ts +2 -2
- package/dist/lang/ast/expressions/expr-null.js +4 -4
- package/dist/lang/ast/expressions/expr-number.d.ts +3 -3
- package/dist/lang/ast/expressions/expr-number.js +2 -2
- package/dist/lang/ast/expressions/expr-parens.d.ts +3 -3
- package/dist/lang/ast/expressions/expr-parens.js +3 -3
- package/dist/lang/ast/expressions/expr-regex.d.ts +2 -2
- package/dist/lang/ast/expressions/expr-regex.js +4 -4
- package/dist/lang/ast/expressions/expr-string.d.ts +3 -3
- package/dist/lang/ast/expressions/expr-string.js +8 -8
- package/dist/lang/ast/expressions/expr-sum.d.ts +3 -3
- package/dist/lang/ast/expressions/expr-sum.js +2 -2
- package/dist/lang/ast/expressions/expr-time-extract.d.ts +4 -4
- package/dist/lang/ast/expressions/expr-time-extract.js +30 -30
- package/dist/lang/ast/expressions/expr-time.d.ts +4 -4
- package/dist/lang/ast/expressions/expr-time.js +10 -10
- package/dist/lang/ast/expressions/expr-ungroup.d.ts +6 -6
- package/dist/lang/ast/expressions/expr-ungroup.js +13 -13
- package/dist/lang/ast/expressions/for-range.d.ts +4 -4
- package/dist/lang/ast/expressions/for-range.js +17 -17
- package/dist/lang/ast/expressions/granular-literal.d.ts +4 -4
- package/dist/lang/ast/expressions/granular-literal.js +34 -34
- package/dist/lang/ast/expressions/partial-compare.d.ts +4 -4
- package/dist/lang/ast/expressions/partial-compare.js +4 -4
- package/dist/lang/ast/expressions/pick-when.d.ts +4 -4
- package/dist/lang/ast/expressions/pick-when.js +32 -32
- package/dist/lang/ast/expressions/range.d.ts +3 -3
- package/dist/lang/ast/expressions/range.js +20 -20
- package/dist/lang/ast/expressions/time-frame.d.ts +2 -2
- package/dist/lang/ast/expressions/time-frame.js +3 -3
- package/dist/lang/ast/expressions/top-by.d.ts +4 -4
- package/dist/lang/ast/expressions/top-by.js +5 -5
- package/dist/lang/ast/expressions/unary.d.ts +1 -1
- package/dist/lang/ast/expressions/unary.js +1 -1
- package/dist/lang/ast/expressions/utils.d.ts +2 -2
- package/dist/lang/ast/expressions/utils.js +6 -6
- package/dist/lang/ast/field-space/column-space-field.d.ts +3 -3
- package/dist/lang/ast/field-space/dynamic-space.d.ts +7 -7
- package/dist/lang/ast/field-space/dynamic-space.js +2 -2
- package/dist/lang/ast/field-space/field-definition-value.d.ts +5 -5
- package/dist/lang/ast/field-space/index-field-space.d.ts +3 -3
- package/dist/lang/ast/field-space/index-field-space.js +4 -4
- package/dist/lang/ast/field-space/join-space-field.d.ts +3 -3
- package/dist/lang/ast/field-space/project-field-space.d.ts +2 -2
- package/dist/lang/ast/field-space/project-field-space.js +5 -5
- package/dist/lang/ast/field-space/query-field-struct.d.ts +3 -3
- package/dist/lang/ast/field-space/query-field-struct.js +1 -1
- package/dist/lang/ast/field-space/query-space-field.d.ts +4 -4
- package/dist/lang/ast/field-space/query-space-field.js +1 -1
- package/dist/lang/ast/field-space/query-spaces.d.ts +11 -11
- package/dist/lang/ast/field-space/query-spaces.js +8 -8
- package/dist/lang/ast/field-space/reference-field.d.ts +5 -5
- package/dist/lang/ast/field-space/reference-field.js +1 -1
- package/dist/lang/ast/field-space/refined-space.d.ts +4 -4
- package/dist/lang/ast/field-space/refined-space.js +2 -2
- package/dist/lang/ast/field-space/rename-space-field.d.ts +3 -3
- package/dist/lang/ast/field-space/rename-space-field.js +2 -2
- package/dist/lang/ast/field-space/static-space.d.ts +7 -7
- package/dist/lang/ast/field-space/static-space.js +12 -12
- package/dist/lang/ast/field-space/struct-space-field-base.d.ts +4 -4
- package/dist/lang/ast/field-space/struct-space-field-base.js +1 -1
- package/dist/lang/ast/field-space/wild-space-field.d.ts +4 -4
- package/dist/lang/ast/field-space/wild-space-field.js +1 -1
- package/dist/lang/ast/fragtype-utils.d.ts +1 -1
- package/dist/lang/ast/fragtype-utils.js +15 -15
- package/dist/lang/ast/index.d.ts +90 -90
- package/dist/lang/ast/parameters/constant-parameter.d.ts +3 -3
- package/dist/lang/ast/parameters/constant-parameter.js +10 -10
- package/dist/lang/ast/parameters/has-parameter.d.ts +3 -3
- package/dist/lang/ast/parameters/has-parameter.js +7 -7
- package/dist/lang/ast/query-elements/anonymous-query.d.ts +3 -3
- package/dist/lang/ast/query-elements/anonymous-query.js +2 -2
- package/dist/lang/ast/query-elements/existing-query.d.ts +4 -4
- package/dist/lang/ast/query-elements/existing-query.js +10 -10
- package/dist/lang/ast/query-elements/full-query.d.ts +4 -4
- package/dist/lang/ast/query-elements/full-query.js +10 -10
- package/dist/lang/ast/query-elements/query-head-struct.d.ts +2 -2
- package/dist/lang/ast/query-elements/query-head-struct.js +2 -2
- package/dist/lang/ast/query-items/field-declaration.d.ts +6 -6
- package/dist/lang/ast/query-items/field-declaration.js +14 -14
- package/dist/lang/ast/query-items/field-references.d.ts +6 -6
- package/dist/lang/ast/query-items/field-references.js +9 -9
- package/dist/lang/ast/query-properties/aggregate.d.ts +2 -2
- package/dist/lang/ast/query-properties/aggregate.js +1 -1
- package/dist/lang/ast/query-properties/declare-fields.d.ts +2 -2
- package/dist/lang/ast/query-properties/declare-fields.js +1 -1
- package/dist/lang/ast/query-properties/dimmensions.d.ts +2 -2
- package/dist/lang/ast/query-properties/dimmensions.js +1 -1
- package/dist/lang/ast/query-properties/filters.d.ts +4 -4
- package/dist/lang/ast/query-properties/filters.js +16 -16
- package/dist/lang/ast/query-properties/group-by.d.ts +2 -2
- package/dist/lang/ast/query-properties/group-by.js +1 -1
- package/dist/lang/ast/query-properties/indexing.d.ts +3 -3
- package/dist/lang/ast/query-properties/indexing.js +3 -3
- package/dist/lang/ast/query-properties/joins.d.ts +6 -6
- package/dist/lang/ast/query-properties/joins.js +27 -27
- package/dist/lang/ast/query-properties/limit.d.ts +1 -1
- package/dist/lang/ast/query-properties/limit.js +1 -1
- package/dist/lang/ast/query-properties/measures.d.ts +2 -2
- package/dist/lang/ast/query-properties/measures.js +1 -1
- package/dist/lang/ast/query-properties/nest-reference.d.ts +2 -2
- package/dist/lang/ast/query-properties/nest-reference.js +1 -1
- package/dist/lang/ast/query-properties/nest.d.ts +7 -7
- package/dist/lang/ast/query-properties/nest.js +7 -7
- package/dist/lang/ast/query-properties/nests.d.ts +2 -2
- package/dist/lang/ast/query-properties/nests.js +1 -1
- package/dist/lang/ast/query-properties/ordering.d.ts +3 -3
- package/dist/lang/ast/query-properties/ordering.js +6 -6
- package/dist/lang/ast/query-properties/project-statement.d.ts +2 -2
- package/dist/lang/ast/query-properties/project-statement.js +1 -1
- package/dist/lang/ast/query-properties/qop-desc.d.ts +7 -7
- package/dist/lang/ast/query-properties/qop-desc.js +20 -20
- package/dist/lang/ast/query-properties/sampling.d.ts +2 -2
- package/dist/lang/ast/query-properties/sampling.js +1 -1
- package/dist/lang/ast/query-properties/top.d.ts +4 -4
- package/dist/lang/ast/query-properties/top.js +5 -5
- package/dist/lang/ast/source-properties/field-list-edit.d.ts +4 -4
- package/dist/lang/ast/source-properties/field-list-edit.js +2 -2
- package/dist/lang/ast/source-properties/primary-key.d.ts +2 -2
- package/dist/lang/ast/source-properties/primary-key.js +2 -2
- package/dist/lang/ast/source-properties/renames.d.ts +2 -2
- package/dist/lang/ast/source-properties/renames.js +3 -3
- package/dist/lang/ast/source-properties/turtles.d.ts +2 -2
- package/dist/lang/ast/source-properties/turtles.js +1 -1
- package/dist/lang/ast/sources/named-source.d.ts +4 -4
- package/dist/lang/ast/sources/named-source.js +5 -5
- package/dist/lang/ast/sources/query-source.d.ts +3 -3
- package/dist/lang/ast/sources/query-source.js +3 -3
- package/dist/lang/ast/sources/sql-source.d.ts +2 -2
- package/dist/lang/ast/sources/sql-source.js +2 -2
- package/dist/lang/ast/sources/table-source.d.ts +2 -2
- package/dist/lang/ast/sources/table-source.js +7 -7
- package/dist/lang/ast/space-seed.d.ts +2 -2
- package/dist/lang/ast/space-seed.js +1 -1
- package/dist/lang/ast/sql-elements/sql-statement.d.ts +4 -4
- package/dist/lang/ast/sql-elements/sql-statement.js +9 -9
- package/dist/lang/ast/sql-elements/sql-string.d.ts +3 -3
- package/dist/lang/ast/sql-elements/sql-string.js +6 -6
- package/dist/lang/ast/struct-utils.d.ts +2 -2
- package/dist/lang/ast/struct-utils.js +3 -3
- package/dist/lang/ast/time-utils.d.ts +6 -6
- package/dist/lang/ast/time-utils.js +46 -46
- package/dist/lang/ast/types/document-compile-result.d.ts +2 -2
- package/dist/lang/ast/types/executor.d.ts +3 -3
- package/dist/lang/ast/types/explore-desc.d.ts +2 -2
- package/dist/lang/ast/types/explore-desc.js +1 -1
- package/dist/lang/ast/types/explore-field.d.ts +3 -3
- package/dist/lang/ast/types/expr-result.d.ts +2 -2
- package/dist/lang/ast/types/expr-value.d.ts +2 -2
- package/dist/lang/ast/types/expression-def.d.ts +4 -4
- package/dist/lang/ast/types/expression-def.js +86 -86
- package/dist/lang/ast/types/field-collection-member.d.ts +3 -3
- package/dist/lang/ast/types/field-decl.d.ts +5 -5
- package/dist/lang/ast/types/field-space.d.ts +5 -5
- package/dist/lang/ast/types/field-space.js +1 -1
- package/dist/lang/ast/types/granular-result.d.ts +3 -3
- package/dist/lang/ast/types/granular-result.js +1 -1
- package/dist/lang/ast/types/lookup-result.d.ts +1 -1
- package/dist/lang/ast/types/malloy-element.d.ts +6 -6
- package/dist/lang/ast/types/malloy-element.js +49 -49
- package/dist/lang/ast/types/model-entry.d.ts +1 -1
- package/dist/lang/ast/types/name-space.d.ts +1 -1
- package/dist/lang/ast/types/nested-query.d.ts +2 -2
- package/dist/lang/ast/types/op-desc.d.ts +2 -2
- package/dist/lang/ast/types/query-comp.d.ts +1 -1
- package/dist/lang/ast/types/query-element.d.ts +3 -3
- package/dist/lang/ast/types/query-item.d.ts +4 -4
- package/dist/lang/ast/types/query-property.d.ts +15 -15
- package/dist/lang/ast/types/source-property.d.ts +8 -8
- package/dist/lang/ast/types/space-entry.d.ts +2 -2
- package/dist/lang/ast/types/space-field.d.ts +4 -4
- package/dist/lang/ast/types/space-field.js +4 -4
- package/dist/lang/ast/types/space-param.d.ts +4 -4
- package/dist/lang/ast/types/space-param.js +4 -4
- package/dist/lang/ast/types/time-result.d.ts +2 -2
- package/dist/lang/ast/types/turtle-headed-pipe.d.ts +2 -2
- package/dist/lang/ast/types/turtle-headed-pipe.js +1 -1
- package/dist/lang/ast/types/type-desc.d.ts +3 -3
- package/dist/lang/field-utils.d.ts +1 -1
- package/dist/lang/field-utils.js +4 -4
- package/dist/lang/index.d.ts +10 -10
- package/dist/lang/malloy-to-ast.d.ts +8 -8
- package/dist/lang/malloy-to-ast.js +68 -68
- package/dist/lang/parse-error-handler.d.ts +3 -3
- package/dist/lang/parse-error-handler.js +4 -4
- package/dist/lang/parse-log.d.ts +2 -2
- package/dist/lang/parse-log.js +1 -1
- package/dist/lang/parse-malloy.d.ts +7 -7
- package/dist/lang/parse-malloy.js +81 -81
- package/dist/lang/parse-tree-walkers/document-completion-walker.d.ts +2 -2
- package/dist/lang/parse-tree-walkers/document-completion-walker.js +38 -38
- package/dist/lang/parse-tree-walkers/document-help-context-walker.d.ts +1 -1
- package/dist/lang/parse-tree-walkers/document-help-context-walker.js +14 -14
- package/dist/lang/parse-tree-walkers/document-highlight-walker.d.ts +3 -3
- package/dist/lang/parse-tree-walkers/document-highlight-walker.js +85 -85
- package/dist/lang/parse-tree-walkers/document-symbol-walker.d.ts +4 -4
- package/dist/lang/parse-tree-walkers/document-symbol-walker.js +40 -40
- package/dist/lang/parse-tree-walkers/explore-query-walker.d.ts +3 -3
- package/dist/lang/parse-tree-walkers/explore-query-walker.js +3 -3
- package/dist/lang/parse-tree-walkers/find-external-references.d.ts +4 -4
- 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 +9 -9
- package/dist/lang/test/document-symbol-walker.spec.js +32 -32
- package/dist/lang/test/field-symbols.spec.js +87 -87
- package/dist/lang/test/parse.spec.d.ts +1 -1
- package/dist/lang/test/parse.spec.js +768 -768
- package/dist/lang/test/test-translator.d.ts +6 -6
- package/dist/lang/test/test-translator.js +159 -159
- package/dist/lang/translate-response.d.ts +7 -7
- package/dist/lang/translate-response.js +1 -1
- package/dist/lang/zone.d.ts +5 -5
- package/dist/lang/zone.js +8 -8
- package/dist/malloy.d.ts +7 -7
- package/dist/malloy.js +192 -192
- package/dist/model/index.d.ts +2 -2
- package/dist/model/malloy_query.d.ts +12 -12
- package/dist/model/malloy_query.js +497 -502
- package/dist/model/malloy_types.d.ts +68 -68
- package/dist/model/malloy_types.js +102 -102
- package/dist/model/sql_block.d.ts +1 -1
- package/dist/model/sql_block.js +4 -4
- package/dist/model/utils.d.ts +1 -1
- package/dist/model/utils.js +10 -10
- package/dist/runtime_types.d.ts +2 -2
- package/package.json +4 -1
|
@@ -37,14 +37,14 @@ const nest_1 = require("./nest");
|
|
|
37
37
|
const static_space_1 = require("../field-space/static-space");
|
|
38
38
|
class QOPDesc extends malloy_element_1.ListOf {
|
|
39
39
|
constructor(props) {
|
|
40
|
-
super(
|
|
41
|
-
this.opType =
|
|
40
|
+
super('queryOperator', props);
|
|
41
|
+
this.opType = 'grouping';
|
|
42
42
|
}
|
|
43
43
|
computeType() {
|
|
44
44
|
let firstGuess;
|
|
45
45
|
if (this.refineThis) {
|
|
46
|
-
if (this.refineThis.type
|
|
47
|
-
firstGuess =
|
|
46
|
+
if (this.refineThis.type === 'reduce') {
|
|
47
|
+
firstGuess = 'grouping';
|
|
48
48
|
}
|
|
49
49
|
else {
|
|
50
50
|
firstGuess = this.refineThis.type;
|
|
@@ -53,40 +53,40 @@ class QOPDesc extends malloy_element_1.ListOf {
|
|
|
53
53
|
let anyGrouping = false;
|
|
54
54
|
for (const el of this.list) {
|
|
55
55
|
if (el instanceof indexing_1.Index) {
|
|
56
|
-
firstGuess || (firstGuess =
|
|
57
|
-
if (firstGuess !==
|
|
56
|
+
firstGuess || (firstGuess = 'index');
|
|
57
|
+
if (firstGuess !== 'index') {
|
|
58
58
|
el.log(`index: not legal in ${firstGuess} query`);
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
else if (el instanceof nests_1.Nests ||
|
|
62
62
|
(0, nest_1.isNestedQuery)(el) ||
|
|
63
63
|
el instanceof group_by_1.GroupBy) {
|
|
64
|
-
firstGuess || (firstGuess =
|
|
64
|
+
firstGuess || (firstGuess = 'grouping');
|
|
65
65
|
anyGrouping = true;
|
|
66
|
-
if (firstGuess ===
|
|
66
|
+
if (firstGuess === 'project' || firstGuess === 'index') {
|
|
67
67
|
el.log(`group_by: not legal in ${firstGuess} query`);
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
else if (el instanceof aggregate_1.Aggregate) {
|
|
71
|
-
firstGuess || (firstGuess =
|
|
72
|
-
if (firstGuess ===
|
|
71
|
+
firstGuess || (firstGuess = 'aggregate');
|
|
72
|
+
if (firstGuess === 'project' || firstGuess === 'index') {
|
|
73
73
|
el.log(`aggregate: not legal in ${firstGuess} query`);
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
else if (el instanceof project_statement_1.ProjectStatement) {
|
|
77
|
-
firstGuess || (firstGuess =
|
|
78
|
-
if (firstGuess !==
|
|
77
|
+
firstGuess || (firstGuess = 'project');
|
|
78
|
+
if (firstGuess !== 'project') {
|
|
79
79
|
el.log(`project: not legal in ${firstGuess} query`);
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
-
if (firstGuess ===
|
|
84
|
-
firstGuess =
|
|
83
|
+
if (firstGuess === 'aggregate' && anyGrouping) {
|
|
84
|
+
firstGuess = 'grouping';
|
|
85
85
|
}
|
|
86
86
|
if (!firstGuess) {
|
|
87
87
|
this.log("Can't determine query type (group_by/aggregate/nest,project,index)");
|
|
88
88
|
}
|
|
89
|
-
const guessType = firstGuess ||
|
|
89
|
+
const guessType = firstGuess || 'grouping';
|
|
90
90
|
this.opType = guessType;
|
|
91
91
|
return guessType;
|
|
92
92
|
}
|
|
@@ -95,12 +95,12 @@ class QOPDesc extends malloy_element_1.ListOf {
|
|
|
95
95
|
}
|
|
96
96
|
getExecutor(baseFS) {
|
|
97
97
|
switch (this.computeType()) {
|
|
98
|
-
case
|
|
99
|
-
case
|
|
98
|
+
case 'aggregate':
|
|
99
|
+
case 'grouping':
|
|
100
100
|
return new reduce_executor_1.ReduceExecutor(baseFS);
|
|
101
|
-
case
|
|
101
|
+
case 'project':
|
|
102
102
|
return new project_executor_1.ProjectExecutor(baseFS);
|
|
103
|
-
case
|
|
103
|
+
case 'index':
|
|
104
104
|
return new index_executor_1.IndexExecutor(baseFS);
|
|
105
105
|
}
|
|
106
106
|
}
|
|
@@ -116,7 +116,7 @@ class QOPDesc extends malloy_element_1.ListOf {
|
|
|
116
116
|
const segment = qex.finalize(this.refineThis);
|
|
117
117
|
return {
|
|
118
118
|
segment,
|
|
119
|
-
|
|
119
|
+
outputSpace: () => new static_space_1.StaticSpace((0, struct_utils_1.opOutputStruct)(this, inputFS.structDef(), segment)),
|
|
120
120
|
};
|
|
121
121
|
}
|
|
122
122
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Sampling } from
|
|
2
|
-
import { MalloyElement } from
|
|
1
|
+
import { Sampling } from '../../../model/malloy_types';
|
|
2
|
+
import { MalloyElement } from '../types/malloy-element';
|
|
3
3
|
export declare class SampleProperty extends MalloyElement {
|
|
4
4
|
readonly sample: Sampling;
|
|
5
5
|
elementType: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { By as ModelBy } from
|
|
2
|
-
import { ExpressionDef } from
|
|
3
|
-
import { FieldName, FieldSpace } from
|
|
4
|
-
import { MalloyElement } from
|
|
1
|
+
import { By as ModelBy } from '../../../model/malloy_types';
|
|
2
|
+
import { ExpressionDef } from '../types/expression-def';
|
|
3
|
+
import { FieldName, FieldSpace } from '../types/field-space';
|
|
4
|
+
import { MalloyElement } from '../types/malloy-element';
|
|
5
5
|
declare type TopInit = FieldName | ExpressionDef;
|
|
6
6
|
export declare class Top extends MalloyElement {
|
|
7
7
|
readonly limit: number;
|
|
@@ -32,8 +32,8 @@ class Top extends malloy_element_1.MalloyElement {
|
|
|
32
32
|
super();
|
|
33
33
|
this.limit = limit;
|
|
34
34
|
this.by = by;
|
|
35
|
-
this.elementType =
|
|
36
|
-
this.has({
|
|
35
|
+
this.elementType = 'top';
|
|
36
|
+
this.has({ by: by });
|
|
37
37
|
}
|
|
38
38
|
getBy(fs) {
|
|
39
39
|
if (this.by) {
|
|
@@ -43,14 +43,14 @@ class Top extends malloy_element_1.MalloyElement {
|
|
|
43
43
|
// if (entry.error) {
|
|
44
44
|
// this.by.log(entry.error);
|
|
45
45
|
// }
|
|
46
|
-
return {
|
|
46
|
+
return { by: 'name', name: this.by.refString };
|
|
47
47
|
}
|
|
48
48
|
else {
|
|
49
49
|
const byExpr = this.by.getExpression(fs);
|
|
50
50
|
if ((0, malloy_types_1.expressionIsAggregate)(byExpr.expressionType)) {
|
|
51
|
-
this.log(
|
|
51
|
+
this.log('top by expression must be an aggregate');
|
|
52
52
|
}
|
|
53
|
-
return {
|
|
53
|
+
return { by: 'expression', e: (0, utils_1.compressExpr)(byExpr.value) };
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
return undefined;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { FieldReferences } from
|
|
2
|
-
import { MalloyElement } from
|
|
1
|
+
import { FieldReferences } from '../query-items/field-references';
|
|
2
|
+
import { MalloyElement } from '../types/malloy-element';
|
|
3
3
|
export declare class FieldListEdit extends MalloyElement {
|
|
4
|
-
readonly edit:
|
|
4
|
+
readonly edit: 'accept' | 'except';
|
|
5
5
|
readonly refs: FieldReferences;
|
|
6
6
|
elementType: string;
|
|
7
|
-
constructor(edit:
|
|
7
|
+
constructor(edit: 'accept' | 'except', refs: FieldReferences);
|
|
8
8
|
}
|
|
@@ -26,10 +26,10 @@ exports.FieldListEdit = void 0;
|
|
|
26
26
|
const malloy_element_1 = require("../types/malloy-element");
|
|
27
27
|
class FieldListEdit extends malloy_element_1.MalloyElement {
|
|
28
28
|
constructor(edit, refs) {
|
|
29
|
-
super({
|
|
29
|
+
super({ refs: refs });
|
|
30
30
|
this.edit = edit;
|
|
31
31
|
this.refs = refs;
|
|
32
|
-
this.elementType =
|
|
32
|
+
this.elementType = 'fieldListEdit';
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
exports.FieldListEdit = FieldListEdit;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FieldName } from
|
|
2
|
-
import { MalloyElement } from
|
|
1
|
+
import { FieldName } from '../types/field-space';
|
|
2
|
+
import { MalloyElement } from '../types/malloy-element';
|
|
3
3
|
export declare class PrimaryKey extends MalloyElement {
|
|
4
4
|
readonly field: FieldName;
|
|
5
5
|
elementType: string;
|
|
@@ -26,9 +26,9 @@ exports.PrimaryKey = void 0;
|
|
|
26
26
|
const malloy_element_1 = require("../types/malloy-element");
|
|
27
27
|
class PrimaryKey extends malloy_element_1.MalloyElement {
|
|
28
28
|
constructor(field) {
|
|
29
|
-
super({
|
|
29
|
+
super({ field: field });
|
|
30
30
|
this.field = field;
|
|
31
|
-
this.elementType =
|
|
31
|
+
this.elementType = 'primary key';
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
exports.PrimaryKey = PrimaryKey;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FieldName } from
|
|
2
|
-
import { ListOf, MalloyElement } from
|
|
1
|
+
import { FieldName } from '../types/field-space';
|
|
2
|
+
import { ListOf, MalloyElement } from '../types/malloy-element';
|
|
3
3
|
export declare class RenameField extends MalloyElement {
|
|
4
4
|
readonly newName: string;
|
|
5
5
|
readonly oldName: FieldName;
|
|
@@ -29,14 +29,14 @@ class RenameField extends malloy_element_1.MalloyElement {
|
|
|
29
29
|
super();
|
|
30
30
|
this.newName = newName;
|
|
31
31
|
this.oldName = oldName;
|
|
32
|
-
this.elementType =
|
|
33
|
-
this.has({
|
|
32
|
+
this.elementType = 'renameField';
|
|
33
|
+
this.has({ oldName: oldName });
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
exports.RenameField = RenameField;
|
|
37
37
|
class Renames extends malloy_element_1.ListOf {
|
|
38
38
|
constructor(renames) {
|
|
39
|
-
super(
|
|
39
|
+
super('renameField', renames);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
exports.Renames = Renames;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TurtleDecl } from
|
|
2
|
-
import { ListOf } from
|
|
1
|
+
import { TurtleDecl } from '../query-properties/nest';
|
|
2
|
+
import { ListOf } from '../types/malloy-element';
|
|
3
3
|
export declare class Turtles extends ListOf<TurtleDecl> {
|
|
4
4
|
constructor(turtles: TurtleDecl[]);
|
|
5
5
|
}
|
|
@@ -26,7 +26,7 @@ exports.Turtles = void 0;
|
|
|
26
26
|
const malloy_element_1 = require("../types/malloy-element");
|
|
27
27
|
class Turtles extends malloy_element_1.ListOf {
|
|
28
28
|
constructor(turtles) {
|
|
29
|
-
super(
|
|
29
|
+
super('turtleDeclarationList', turtles);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
exports.Turtles = Turtles;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { StructDef, StructRef } from
|
|
2
|
-
import { Source } from
|
|
3
|
-
import { ConstantSubExpression } from
|
|
4
|
-
import { MalloyElement, ModelEntryReference } from
|
|
1
|
+
import { StructDef, StructRef } from '../../../model/malloy_types';
|
|
2
|
+
import { Source } from '../elements/source';
|
|
3
|
+
import { ConstantSubExpression } from '../expressions/constant-sub-expression';
|
|
4
|
+
import { MalloyElement, ModelEntryReference } from '../types/malloy-element';
|
|
5
5
|
export declare class IsValueBlock extends MalloyElement {
|
|
6
6
|
readonly isMap: Record<string, ConstantSubExpression>;
|
|
7
7
|
elementType: string;
|
|
@@ -32,7 +32,7 @@ class IsValueBlock extends malloy_element_1.MalloyElement {
|
|
|
32
32
|
constructor(isMap) {
|
|
33
33
|
super();
|
|
34
34
|
this.isMap = isMap;
|
|
35
|
-
this.elementType =
|
|
35
|
+
this.elementType = 'isValueBlock';
|
|
36
36
|
this.has(isMap);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
@@ -41,13 +41,13 @@ class NamedSource extends source_1.Source {
|
|
|
41
41
|
constructor(ref, paramValues = {}) {
|
|
42
42
|
super();
|
|
43
43
|
this.ref = ref;
|
|
44
|
-
this.elementType =
|
|
44
|
+
this.elementType = 'namedSource';
|
|
45
45
|
if (paramValues && Object.keys(paramValues).length > 0) {
|
|
46
46
|
this.isBlock = new IsValueBlock(paramValues);
|
|
47
|
-
this.has({
|
|
47
|
+
this.has({ parameterValues: this.isBlock });
|
|
48
48
|
}
|
|
49
49
|
if (ref instanceof malloy_element_1.ModelEntryReference) {
|
|
50
|
-
this.has({
|
|
50
|
+
this.has({ ref: ref });
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
get refName() {
|
|
@@ -73,7 +73,7 @@ class NamedSource extends source_1.Source {
|
|
|
73
73
|
(this.ref instanceof malloy_element_1.ModelEntryReference ? this.ref : this).log(undefMsg);
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
|
-
if (entry.type ===
|
|
76
|
+
if (entry.type === 'query') {
|
|
77
77
|
this.log(`Must use 'from()' for query source '${this.refName}`);
|
|
78
78
|
return;
|
|
79
79
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { StructDef } from
|
|
2
|
-
import { Source } from
|
|
3
|
-
import { QueryElement } from
|
|
1
|
+
import { StructDef } from '../../../model/malloy_types';
|
|
2
|
+
import { Source } from '../elements/source';
|
|
3
|
+
import { QueryElement } from '../types/query-element';
|
|
4
4
|
export declare class QuerySource extends Source {
|
|
5
5
|
readonly query: QueryElement;
|
|
6
6
|
elementType: string;
|
|
@@ -26,14 +26,14 @@ exports.QuerySource = void 0;
|
|
|
26
26
|
const source_1 = require("../elements/source");
|
|
27
27
|
class QuerySource extends source_1.Source {
|
|
28
28
|
constructor(query) {
|
|
29
|
-
super({
|
|
29
|
+
super({ query: query });
|
|
30
30
|
this.query = query;
|
|
31
|
-
this.elementType =
|
|
31
|
+
this.elementType = 'querySource';
|
|
32
32
|
}
|
|
33
33
|
structDef() {
|
|
34
34
|
const comp = this.query.queryComp();
|
|
35
35
|
const queryStruct = comp.outputStruct;
|
|
36
|
-
queryStruct.structSource = {
|
|
36
|
+
queryStruct.structSource = { type: 'query', query: comp.query };
|
|
37
37
|
return queryStruct;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { StructDef, StructRef } from
|
|
2
|
-
import { NamedSource } from
|
|
1
|
+
import { StructDef, StructRef } from '../../../model/malloy_types';
|
|
2
|
+
import { NamedSource } from './named-source';
|
|
3
3
|
export declare class SQLSource extends NamedSource {
|
|
4
4
|
elementType: string;
|
|
5
5
|
structRef(): StructRef;
|
|
@@ -27,7 +27,7 @@ const named_source_1 = require("./named-source");
|
|
|
27
27
|
class SQLSource extends named_source_1.NamedSource {
|
|
28
28
|
constructor() {
|
|
29
29
|
super(...arguments);
|
|
30
|
-
this.elementType =
|
|
30
|
+
this.elementType = 'sqlSource';
|
|
31
31
|
}
|
|
32
32
|
structRef() {
|
|
33
33
|
return this.structDef();
|
|
@@ -39,7 +39,7 @@ class SQLSource extends named_source_1.NamedSource {
|
|
|
39
39
|
this.log(`Undefined from_sql source '${this.refName}'`);
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
|
-
if (entry.type ===
|
|
42
|
+
if (entry.type === 'query') {
|
|
43
43
|
this.log(`Cannot use 'from_sql()' to explore query '${this.refName}'`);
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { StructDef } from
|
|
2
|
-
import { Source } from
|
|
1
|
+
import { StructDef } from '../../../model/malloy_types';
|
|
2
|
+
import { Source } from '../elements/source';
|
|
3
3
|
export declare class TableSource extends Source {
|
|
4
4
|
readonly name: string;
|
|
5
5
|
elementType: string;
|
|
@@ -29,28 +29,28 @@ class TableSource extends source_1.Source {
|
|
|
29
29
|
constructor(name) {
|
|
30
30
|
super();
|
|
31
31
|
this.name = name;
|
|
32
|
-
this.elementType =
|
|
32
|
+
this.elementType = 'tableSource';
|
|
33
33
|
}
|
|
34
34
|
structDef() {
|
|
35
35
|
var _a;
|
|
36
36
|
const tableDefEntry = (_a = this.translator()) === null || _a === void 0 ? void 0 : _a.root.schemaZone.getEntry(this.name);
|
|
37
37
|
let msg = `Schema read failure for table '${this.name}'`;
|
|
38
38
|
if (tableDefEntry) {
|
|
39
|
-
if (tableDefEntry.status
|
|
39
|
+
if (tableDefEntry.status === 'present') {
|
|
40
40
|
tableDefEntry.value.location = this.location;
|
|
41
|
-
tableDefEntry.value.fields.forEach(
|
|
41
|
+
tableDefEntry.value.fields.forEach(field => {
|
|
42
42
|
field.location = this.location;
|
|
43
43
|
});
|
|
44
44
|
return {
|
|
45
45
|
...tableDefEntry.value,
|
|
46
|
-
|
|
46
|
+
fields: tableDefEntry.value.fields.map(field => ({
|
|
47
47
|
...field,
|
|
48
|
-
|
|
48
|
+
location: this.location,
|
|
49
49
|
})),
|
|
50
|
-
|
|
50
|
+
location: this.location,
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
|
-
if (tableDefEntry.status
|
|
53
|
+
if (tableDefEntry.status === 'error') {
|
|
54
54
|
msg = tableDefEntry.message;
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { StructDef } from
|
|
2
|
-
import { FieldSpace } from
|
|
1
|
+
import { StructDef } from '../../model/malloy_types';
|
|
2
|
+
import { FieldSpace } from './types/field-space';
|
|
3
3
|
export declare type SourceSpec = StructDef | FieldSpace;
|
|
4
4
|
/**
|
|
5
5
|
* Based on how things are constructed, a DynamicSpace can be seeded
|
|
@@ -25,7 +25,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
25
25
|
exports.SpaceSeed = void 0;
|
|
26
26
|
const static_space_1 = require("./field-space/static-space");
|
|
27
27
|
function isFieldSpace(x) {
|
|
28
|
-
return x.type
|
|
28
|
+
return x.type === 'fieldSpace';
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* Based on how things are constructed, a DynamicSpace can be seeded
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { SQLBlockSource } from
|
|
2
|
-
import { ModelDataRequest } from
|
|
3
|
-
import { DocStatement, Document, MalloyElement } from
|
|
4
|
-
import { SQLString } from
|
|
1
|
+
import { SQLBlockSource } from '../../../model/malloy_types';
|
|
2
|
+
import { ModelDataRequest } from '../../translate-response';
|
|
3
|
+
import { DocStatement, Document, MalloyElement } from '../types/malloy-element';
|
|
4
|
+
import { SQLString } from './sql-string';
|
|
5
5
|
export declare class SQLStatement extends MalloyElement implements DocStatement {
|
|
6
6
|
readonly select: SQLString;
|
|
7
7
|
elementType: string;
|
|
@@ -29,8 +29,8 @@ class SQLStatement extends malloy_element_1.MalloyElement {
|
|
|
29
29
|
constructor(select) {
|
|
30
30
|
super();
|
|
31
31
|
this.select = select;
|
|
32
|
-
this.elementType =
|
|
33
|
-
this.has({
|
|
32
|
+
this.elementType = 'sqlStatement';
|
|
33
|
+
this.has({ select: select });
|
|
34
34
|
}
|
|
35
35
|
sqlBlock() {
|
|
36
36
|
if (!this.requestBlock) {
|
|
@@ -53,17 +53,17 @@ class SQLStatement extends malloy_element_1.MalloyElement {
|
|
|
53
53
|
const sql = this.sqlBlock();
|
|
54
54
|
sqlDefEntry.reference(sql.name, this.location);
|
|
55
55
|
const lookup = sqlDefEntry.getEntry(sql.name);
|
|
56
|
-
if (lookup.status
|
|
56
|
+
if (lookup.status === 'error') {
|
|
57
57
|
const msgLines = lookup.message.split(/\r?\n/);
|
|
58
|
-
this.select.log(
|
|
58
|
+
this.select.log('Invalid SQL, ' + msgLines.join('\n '));
|
|
59
59
|
return undefined;
|
|
60
60
|
}
|
|
61
|
-
if (lookup.status
|
|
61
|
+
if (lookup.status === 'present') {
|
|
62
62
|
const location = this.select.location;
|
|
63
63
|
const locStruct = {
|
|
64
64
|
...lookup.value,
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
fields: lookup.value.fields.map(f => ({ ...f, location })),
|
|
66
|
+
location: this.location,
|
|
67
67
|
};
|
|
68
68
|
if (this.is && !doc.defineSQL(locStruct, this.is)) {
|
|
69
69
|
this.log(`'${this.is}' already defined`);
|
|
@@ -71,8 +71,8 @@ class SQLStatement extends malloy_element_1.MalloyElement {
|
|
|
71
71
|
return undefined;
|
|
72
72
|
}
|
|
73
73
|
return {
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
compileSQL: sql,
|
|
75
|
+
partialModel: this.select.containsQueries ? doc.modelDef() : undefined,
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
78
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { SQLPhrase } from
|
|
2
|
-
import { QueryElement } from
|
|
3
|
-
import { MalloyElement } from
|
|
1
|
+
import { SQLPhrase } from '../../../model/malloy_types';
|
|
2
|
+
import { QueryElement } from '../types/query-element';
|
|
3
|
+
import { MalloyElement } from '../types/malloy-element';
|
|
4
4
|
declare type SQLStringSegment = string | QueryElement;
|
|
5
5
|
export declare class SQLString extends MalloyElement {
|
|
6
6
|
elementType: string;
|
|
@@ -28,12 +28,12 @@ const malloy_element_1 = require("../types/malloy-element");
|
|
|
28
28
|
class SQLString extends malloy_element_1.MalloyElement {
|
|
29
29
|
constructor() {
|
|
30
30
|
super(...arguments);
|
|
31
|
-
this.elementType =
|
|
31
|
+
this.elementType = 'sqlString';
|
|
32
32
|
this.elements = [];
|
|
33
33
|
this.containsQueries = false;
|
|
34
34
|
}
|
|
35
35
|
push(el) {
|
|
36
|
-
if (typeof el
|
|
36
|
+
if (typeof el === 'string') {
|
|
37
37
|
if (el.length > 0) {
|
|
38
38
|
this.elements.push(el);
|
|
39
39
|
}
|
|
@@ -44,13 +44,13 @@ class SQLString extends malloy_element_1.MalloyElement {
|
|
|
44
44
|
el.parent = this;
|
|
45
45
|
}
|
|
46
46
|
else {
|
|
47
|
-
el.log(
|
|
47
|
+
el.log('This element is not legal inside an SQL string');
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
sqlPhrases() {
|
|
51
|
-
return this.elements.map(
|
|
52
|
-
if (typeof el
|
|
53
|
-
return {
|
|
51
|
+
return this.elements.map(el => {
|
|
52
|
+
if (typeof el === 'string') {
|
|
53
|
+
return { sql: el };
|
|
54
54
|
}
|
|
55
55
|
return el.query();
|
|
56
56
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FieldDef, PipeSegment, StructDef } from
|
|
2
|
-
import { MalloyElement } from
|
|
1
|
+
import { FieldDef, PipeSegment, StructDef } from '../../model/malloy_types';
|
|
2
|
+
import { MalloyElement } from './types/malloy-element';
|
|
3
3
|
export declare function opOutputStruct(logTo: MalloyElement, inputStruct: StructDef, opDesc: PipeSegment): StructDef;
|
|
4
4
|
export declare function getStructFieldDef(s: StructDef, fn: string): FieldDef | undefined;
|
|
@@ -35,14 +35,14 @@ function opOutputStruct(logTo, inputStruct, opDesc) {
|
|
|
35
35
|
}
|
|
36
36
|
catch (e) {
|
|
37
37
|
logTo.log(`INTERNAL ERROR model/Segment.nextStructDef: ${e.message}\n` +
|
|
38
|
-
`QUERY: ${(0, util_1.inspect)(opDesc, {
|
|
38
|
+
`QUERY: ${(0, util_1.inspect)(opDesc, { breakLength: 72, depth: Infinity })}`);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
return { ...error_factory_1.ErrorFactory.structDef,
|
|
41
|
+
return { ...error_factory_1.ErrorFactory.structDef, dialect: inputStruct.dialect };
|
|
42
42
|
}
|
|
43
43
|
exports.opOutputStruct = opOutputStruct;
|
|
44
44
|
function getStructFieldDef(s, fn) {
|
|
45
|
-
return s.fields.find(
|
|
45
|
+
return s.fields.find(fld => (fld.as || fld.name) === fn);
|
|
46
46
|
}
|
|
47
47
|
exports.getStructFieldDef = getStructFieldDef;
|
|
48
48
|
//# sourceMappingURL=struct-utils.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { AtomicFieldType, Expr, Fragment, TimeFieldType, TimestampUnit } from
|
|
2
|
-
import { GranularResult } from
|
|
3
|
-
import { TimeResult } from
|
|
4
|
-
export declare function timeOffset(timeType: TimeFieldType, from: Expr, op:
|
|
1
|
+
import { AtomicFieldType, Expr, Fragment, TimeFieldType, TimestampUnit } from '../../model/malloy_types';
|
|
2
|
+
import { GranularResult } from './types/granular-result';
|
|
3
|
+
import { TimeResult } from './types/time-result';
|
|
4
|
+
export declare function timeOffset(timeType: TimeFieldType, from: Expr, op: '+' | '-', n: Expr, timeframe: TimestampUnit): Expr;
|
|
5
5
|
export declare function castTo(castType: AtomicFieldType, from: Expr, safe?: boolean): Expr;
|
|
6
6
|
export declare function castTimestampToDate(from: Expr, safe?: boolean): Expr;
|
|
7
7
|
export declare function castDateToTimestamp(from: Expr, safe?: boolean): Expr;
|
|
8
8
|
export declare function resolution(timeframe: string): TimeFieldType;
|
|
9
9
|
export declare function timeResult(t: TimeResult, tt: TimestampUnit | undefined): TimeResult | GranularResult;
|
|
10
10
|
export declare function timeLiteral(literalStr: string, timeType: TimeFieldType, tz: string): Expr;
|
|
11
|
-
export declare function timestampOffset(from: Fragment[], op:
|
|
12
|
-
export declare function dateOffset(from: Fragment[], op:
|
|
11
|
+
export declare function timestampOffset(from: Fragment[], op: '+' | '-', n: Fragment[], timeframe: TimestampUnit, fromNotTimestamp?: boolean): Fragment[];
|
|
12
|
+
export declare function dateOffset(from: Fragment[], op: '+' | '-', n: Fragment[], timeframe: TimestampUnit): Fragment[];
|