@malloydata/malloy 0.0.24-dev230224184907 → 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
|
@@ -27,113 +27,113 @@ const utils_1 = require("./expressions/utils");
|
|
|
27
27
|
function timeOffset(timeType, from, op, n, timeframe) {
|
|
28
28
|
return [
|
|
29
29
|
{
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
type: 'dialect',
|
|
31
|
+
function: 'delta',
|
|
32
|
+
base: { valueType: timeType, value: from },
|
|
33
33
|
op,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
34
|
+
delta: n,
|
|
35
|
+
units: timeframe,
|
|
36
|
+
},
|
|
37
37
|
];
|
|
38
38
|
}
|
|
39
39
|
exports.timeOffset = timeOffset;
|
|
40
40
|
function castTo(castType, from, safe = false) {
|
|
41
41
|
const cast = {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
safe
|
|
42
|
+
type: 'dialect',
|
|
43
|
+
function: 'cast',
|
|
44
|
+
dstType: castType,
|
|
45
|
+
expr: from,
|
|
46
|
+
safe,
|
|
47
47
|
};
|
|
48
48
|
return [cast];
|
|
49
49
|
}
|
|
50
50
|
exports.castTo = castTo;
|
|
51
51
|
function castTimestampToDate(from, safe = false) {
|
|
52
52
|
const cast = {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
safe
|
|
53
|
+
type: 'dialect',
|
|
54
|
+
function: 'cast',
|
|
55
|
+
dstType: 'date',
|
|
56
|
+
srcType: 'timestamp',
|
|
57
|
+
expr: from,
|
|
58
|
+
safe,
|
|
59
59
|
};
|
|
60
60
|
return [cast];
|
|
61
61
|
}
|
|
62
62
|
exports.castTimestampToDate = castTimestampToDate;
|
|
63
63
|
function castDateToTimestamp(from, safe = false) {
|
|
64
64
|
const cast = {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
safe
|
|
65
|
+
type: 'dialect',
|
|
66
|
+
function: 'cast',
|
|
67
|
+
dstType: 'timestamp',
|
|
68
|
+
srcType: 'date',
|
|
69
|
+
expr: from,
|
|
70
|
+
safe,
|
|
71
71
|
};
|
|
72
72
|
return [cast];
|
|
73
73
|
}
|
|
74
74
|
exports.castDateToTimestamp = castDateToTimestamp;
|
|
75
75
|
function resolution(timeframe) {
|
|
76
76
|
switch (timeframe) {
|
|
77
|
-
case
|
|
78
|
-
case
|
|
79
|
-
case
|
|
80
|
-
case
|
|
81
|
-
case
|
|
82
|
-
return
|
|
77
|
+
case 'hour':
|
|
78
|
+
case 'minute':
|
|
79
|
+
case 'second':
|
|
80
|
+
case 'microsecond':
|
|
81
|
+
case 'millisecond':
|
|
82
|
+
return 'timestamp';
|
|
83
83
|
}
|
|
84
|
-
return
|
|
84
|
+
return 'date';
|
|
85
85
|
}
|
|
86
86
|
exports.resolution = resolution;
|
|
87
87
|
function timeResult(t, tt) {
|
|
88
88
|
if (tt) {
|
|
89
|
-
return { ...t,
|
|
89
|
+
return { ...t, timeframe: tt };
|
|
90
90
|
}
|
|
91
91
|
return t;
|
|
92
92
|
}
|
|
93
93
|
exports.timeResult = timeResult;
|
|
94
94
|
function timeLiteral(literalStr, timeType, tz) {
|
|
95
95
|
const fragment = {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
96
|
+
type: 'dialect',
|
|
97
|
+
function: 'timeLiteral',
|
|
98
|
+
literal: literalStr,
|
|
99
|
+
literalType: timeType,
|
|
100
|
+
timezone: tz,
|
|
101
101
|
};
|
|
102
102
|
return [fragment];
|
|
103
103
|
}
|
|
104
104
|
exports.timeLiteral = timeLiteral;
|
|
105
105
|
function timestampOffset(from, op, n, timeframe, fromNotTimestamp = false) {
|
|
106
|
-
const useDatetime = [
|
|
107
|
-
const add = op ===
|
|
106
|
+
const useDatetime = ['week', 'month', 'quarter', 'year'].includes(timeframe);
|
|
107
|
+
const add = op === '+' ? '_ADD' : '_SUB';
|
|
108
108
|
const units = timeframe.toUpperCase();
|
|
109
109
|
if (useDatetime) {
|
|
110
110
|
return [
|
|
111
111
|
`TIMESTAMP(DATETIME${add}(DATETIME(`,
|
|
112
112
|
...from,
|
|
113
|
-
|
|
113
|
+
'),INTERVAL ',
|
|
114
114
|
...n,
|
|
115
|
-
` ${units}))
|
|
115
|
+
` ${units}))`,
|
|
116
116
|
];
|
|
117
117
|
}
|
|
118
|
-
const typeFrom = fromNotTimestamp ? [
|
|
118
|
+
const typeFrom = fromNotTimestamp ? ['TIMESTAMP(', ...from, ')'] : from;
|
|
119
119
|
return (0, utils_1.compressExpr)([
|
|
120
120
|
`TIMESTAMP${add}(`,
|
|
121
121
|
...typeFrom,
|
|
122
|
-
|
|
122
|
+
',INTERVAL ',
|
|
123
123
|
...n,
|
|
124
|
-
` ${units})
|
|
124
|
+
` ${units})`,
|
|
125
125
|
]);
|
|
126
126
|
}
|
|
127
127
|
exports.timestampOffset = timestampOffset;
|
|
128
128
|
function dateOffset(from, op, n, timeframe) {
|
|
129
|
-
const add = op ===
|
|
129
|
+
const add = op === '+' ? '_ADD' : '_SUB';
|
|
130
130
|
const units = timeframe.toUpperCase();
|
|
131
131
|
return (0, utils_1.compressExpr)([
|
|
132
132
|
`DATE${add}(`,
|
|
133
133
|
...from,
|
|
134
|
-
|
|
134
|
+
',INTERVAL ',
|
|
135
135
|
...n,
|
|
136
|
-
` ${units})
|
|
136
|
+
` ${units})`,
|
|
137
137
|
]);
|
|
138
138
|
}
|
|
139
139
|
exports.dateOffset = dateOffset;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ModelDef, Query, SQLBlockStructDef } from
|
|
2
|
-
import { ModelDataRequest } from
|
|
1
|
+
import { ModelDef, Query, SQLBlockStructDef } from '../../../model/malloy_types';
|
|
2
|
+
import { ModelDataRequest } from '../../translate-response';
|
|
3
3
|
export interface DocumentCompileResult {
|
|
4
4
|
modelDef: ModelDef;
|
|
5
5
|
queryList: Query[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { PipeSegment } from
|
|
2
|
-
import { QueryProperty } from
|
|
3
|
-
import { QueryInputSpace, QuerySpace } from
|
|
1
|
+
import { PipeSegment } from '../../../model/malloy_types';
|
|
2
|
+
import { QueryProperty } from './query-property';
|
|
3
|
+
import { QueryInputSpace, QuerySpace } from '../field-space/query-spaces';
|
|
4
4
|
export interface Executor {
|
|
5
5
|
inputFS: QueryInputSpace;
|
|
6
6
|
resultFS: QuerySpace;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SourceProperty } from
|
|
2
|
-
import { ListOf } from
|
|
1
|
+
import { SourceProperty } from './source-property';
|
|
2
|
+
import { ListOf } from './malloy-element';
|
|
3
3
|
export declare class ExploreDesc extends ListOf<SourceProperty> {
|
|
4
4
|
constructor(props: SourceProperty[]);
|
|
5
5
|
}
|
|
@@ -26,7 +26,7 @@ exports.ExploreDesc = void 0;
|
|
|
26
26
|
const malloy_element_1 = require("./malloy-element");
|
|
27
27
|
class ExploreDesc extends malloy_element_1.ListOf {
|
|
28
28
|
constructor(props) {
|
|
29
|
-
super(
|
|
29
|
+
super('exploreDesc', props);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
exports.ExploreDesc = ExploreDesc;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { RenameField } from
|
|
2
|
-
import { FieldDecl } from
|
|
3
|
-
import { MalloyElement } from
|
|
1
|
+
import { RenameField } from '../source-properties/renames';
|
|
2
|
+
import { FieldDecl } from './field-decl';
|
|
3
|
+
import { MalloyElement } from './malloy-element';
|
|
4
4
|
export declare type ExploreField = FieldDecl | RenameField;
|
|
5
5
|
export declare function isExploreField(f: MalloyElement): f is ExploreField;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Fragment } from
|
|
2
|
-
import { TypeDesc } from
|
|
1
|
+
import { Fragment } from '../../../model/malloy_types';
|
|
2
|
+
import { TypeDesc } from './type-desc';
|
|
3
3
|
export interface ExprResult extends TypeDesc {
|
|
4
4
|
value: Fragment[];
|
|
5
5
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { GranularResult } from
|
|
2
|
-
import { ExprResult } from
|
|
1
|
+
import { GranularResult } from './granular-result';
|
|
2
|
+
import { ExprResult } from './expr-result';
|
|
3
3
|
export declare type ExprValue = ExprResult | GranularResult;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { TimestampUnit } from
|
|
2
|
-
import { ExprValue } from
|
|
3
|
-
import { FieldSpace } from
|
|
4
|
-
import { MalloyElement } from
|
|
1
|
+
import { TimestampUnit } from '../../../model/malloy_types';
|
|
2
|
+
import { ExprValue } from './expr-value';
|
|
3
|
+
import { FieldSpace } from './field-space';
|
|
4
|
+
import { MalloyElement } from './malloy-element';
|
|
5
5
|
/**
|
|
6
6
|
* Root node for any element in an expression. These essentially
|
|
7
7
|
* create a sub-tree in the larger AST. Expression nodes know
|
|
@@ -90,49 +90,49 @@ class ExpressionDef extends malloy_element_1.MalloyElement {
|
|
|
90
90
|
exports.ExpressionDef = ExpressionDef;
|
|
91
91
|
class ExprDuration extends ExpressionDef {
|
|
92
92
|
constructor(n, timeframe) {
|
|
93
|
-
super({
|
|
93
|
+
super({ n: n });
|
|
94
94
|
this.n = n;
|
|
95
95
|
this.timeframe = timeframe;
|
|
96
|
-
this.elementType =
|
|
96
|
+
this.elementType = 'duration';
|
|
97
97
|
this.legalChildTypes = [fragtype_utils_1.FT.timestampT, fragtype_utils_1.FT.dateT];
|
|
98
98
|
}
|
|
99
99
|
apply(fs, op, left) {
|
|
100
100
|
const lhs = left.getExpression(fs);
|
|
101
101
|
this.typeCheck(this, lhs);
|
|
102
|
-
if ((0, malloy_types_1.isTimeFieldType)(lhs.dataType) && (op ===
|
|
102
|
+
if ((0, malloy_types_1.isTimeFieldType)(lhs.dataType) && (op === '+' || op === '-')) {
|
|
103
103
|
const num = this.n.getExpression(fs);
|
|
104
104
|
if (!fragtype_utils_1.FT.typeEq(num, fragtype_utils_1.FT.numberT)) {
|
|
105
105
|
this.log(`Duration units needs number not '${num.dataType}`);
|
|
106
|
-
return (0, ast_utils_1.errorFor)(
|
|
106
|
+
return (0, ast_utils_1.errorFor)('illegal unit expression');
|
|
107
107
|
}
|
|
108
108
|
let resultGranularity;
|
|
109
109
|
// Only allow the output of this to be granular if the
|
|
110
110
|
// granularities match, this is still an area where
|
|
111
111
|
// more thought is required.
|
|
112
|
-
if ((0, granular_result_1.isGranularResult)(lhs) && lhs.timeframe
|
|
112
|
+
if ((0, granular_result_1.isGranularResult)(lhs) && lhs.timeframe === this.timeframe) {
|
|
113
113
|
resultGranularity = lhs.timeframe;
|
|
114
114
|
}
|
|
115
|
-
if (lhs.dataType ===
|
|
116
|
-
const result = (0, time_utils_1.timeOffset)(
|
|
115
|
+
if (lhs.dataType === 'timestamp') {
|
|
116
|
+
const result = (0, time_utils_1.timeOffset)('timestamp', lhs.value, op, num.value, this.timeframe);
|
|
117
117
|
return (0, time_utils_1.timeResult)({
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
dataType: 'timestamp',
|
|
119
|
+
expressionType: (0, malloy_types_1.maxExpressionType)(lhs.expressionType, num.expressionType),
|
|
120
|
+
value: result,
|
|
121
121
|
}, resultGranularity);
|
|
122
122
|
}
|
|
123
123
|
return (0, time_utils_1.timeResult)({
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
124
|
+
dataType: 'date',
|
|
125
|
+
expressionType: (0, malloy_types_1.maxExpressionType)(lhs.expressionType, num.expressionType),
|
|
126
|
+
value: (0, time_utils_1.timeOffset)('date', lhs.value, op, num.value, this.timeframe),
|
|
127
127
|
}, resultGranularity);
|
|
128
128
|
}
|
|
129
129
|
return super.apply(fs, op, left);
|
|
130
130
|
}
|
|
131
131
|
getExpression(_fs) {
|
|
132
132
|
return {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
133
|
+
dataType: 'duration',
|
|
134
|
+
expressionType: 'scalar',
|
|
135
|
+
value: ['__ERROR_DURATION_IS_NOT_A_VALUE__'],
|
|
136
136
|
};
|
|
137
137
|
}
|
|
138
138
|
}
|
|
@@ -142,7 +142,7 @@ function timeCompare(lhs, op, rhs) {
|
|
|
142
142
|
if (lhs.dataType !== rhs.dataType) {
|
|
143
143
|
let lval = lhs.value;
|
|
144
144
|
let rval = rhs.value;
|
|
145
|
-
if (lhs.dataType ===
|
|
145
|
+
if (lhs.dataType === 'timestamp') {
|
|
146
146
|
lval = (0, time_utils_1.castTimestampToDate)(lval);
|
|
147
147
|
}
|
|
148
148
|
else {
|
|
@@ -154,43 +154,43 @@ function timeCompare(lhs, op, rhs) {
|
|
|
154
154
|
return undefined;
|
|
155
155
|
}
|
|
156
156
|
function regexEqual(left, right) {
|
|
157
|
-
if (left.dataType ===
|
|
158
|
-
if (right.dataType ===
|
|
157
|
+
if (left.dataType === 'string') {
|
|
158
|
+
if (right.dataType === 'regular expression') {
|
|
159
159
|
return [
|
|
160
160
|
{
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
}
|
|
161
|
+
type: 'dialect',
|
|
162
|
+
function: 'regexpMatch',
|
|
163
|
+
expr: left.value,
|
|
164
|
+
regexp: right.value[0].replace(/^r'/, "'"),
|
|
165
|
+
},
|
|
166
166
|
];
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
|
-
else if (right.dataType ===
|
|
170
|
-
if (left.dataType ===
|
|
169
|
+
else if (right.dataType === 'string') {
|
|
170
|
+
if (left.dataType === 'regular expression') {
|
|
171
171
|
return [
|
|
172
172
|
{
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
}
|
|
173
|
+
type: 'dialect',
|
|
174
|
+
function: 'regexpMatch',
|
|
175
|
+
expr: right.value,
|
|
176
|
+
regexp: left.value[0].replace(/^r'/, "'"),
|
|
177
|
+
},
|
|
178
178
|
];
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
return undefined;
|
|
182
182
|
}
|
|
183
183
|
function nullCompare(left, op, right) {
|
|
184
|
-
const not = op ===
|
|
185
|
-
if (left.dataType ===
|
|
186
|
-
const maybeNot = not ?
|
|
187
|
-
if (left.dataType !==
|
|
184
|
+
const not = op === '!=' || op === '!~';
|
|
185
|
+
if (left.dataType === 'null' || right.dataType === 'null') {
|
|
186
|
+
const maybeNot = not ? ' NOT' : '';
|
|
187
|
+
if (left.dataType !== 'null') {
|
|
188
188
|
return [...left.value, ` IS${maybeNot} NULL`];
|
|
189
189
|
}
|
|
190
|
-
if (right.dataType !==
|
|
190
|
+
if (right.dataType !== 'null') {
|
|
191
191
|
return [...right.value, `IS${maybeNot} NULL`];
|
|
192
192
|
}
|
|
193
|
-
return [not ?
|
|
193
|
+
return [not ? 'false' : 'true'];
|
|
194
194
|
}
|
|
195
195
|
return undefined;
|
|
196
196
|
}
|
|
@@ -198,24 +198,24 @@ function equality(fs, left, op, right) {
|
|
|
198
198
|
const lhs = left.getExpression(fs);
|
|
199
199
|
const rhs = right.getExpression(fs);
|
|
200
200
|
// Unsupported types can be compare with null
|
|
201
|
-
const checkUnsupport = lhs.dataType ===
|
|
201
|
+
const checkUnsupport = lhs.dataType === 'unsupported' || rhs.dataType === 'unsupported';
|
|
202
202
|
if (checkUnsupport) {
|
|
203
|
-
const oneNull = lhs.dataType ===
|
|
203
|
+
const oneNull = lhs.dataType === 'null' || rhs.dataType === 'null';
|
|
204
204
|
const rawMatch = lhs.rawType && lhs.rawType === rhs.rawType;
|
|
205
205
|
if (!(oneNull || rawMatch)) {
|
|
206
206
|
const noGo = unsupportError(left, lhs, right, rhs);
|
|
207
207
|
if (noGo) {
|
|
208
|
-
return { ...noGo,
|
|
208
|
+
return { ...noGo, dataType: 'boolean' };
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
212
|
let value = timeCompare(lhs, op, rhs) || (0, utils_1.compose)(lhs.value, op, rhs.value);
|
|
213
|
-
if (lhs.dataType
|
|
213
|
+
if (lhs.dataType !== 'unknown' && rhs.dataType !== 'unknown') {
|
|
214
214
|
switch (op) {
|
|
215
|
-
case
|
|
216
|
-
case
|
|
217
|
-
if (lhs.dataType ===
|
|
218
|
-
value = (0, utils_1.compose)(lhs.value,
|
|
215
|
+
case '~':
|
|
216
|
+
case '!~': {
|
|
217
|
+
if (lhs.dataType === 'string' && rhs.dataType === 'string') {
|
|
218
|
+
value = (0, utils_1.compose)(lhs.value, 'LIKE', rhs.value);
|
|
219
219
|
}
|
|
220
220
|
else {
|
|
221
221
|
const regexCmp = regexEqual(lhs, rhs);
|
|
@@ -227,23 +227,23 @@ function equality(fs, left, op, right) {
|
|
|
227
227
|
value = (0, utils_1.nullsafeNot)(value, op);
|
|
228
228
|
break;
|
|
229
229
|
}
|
|
230
|
-
case
|
|
231
|
-
case
|
|
230
|
+
case '=':
|
|
231
|
+
case '!=': {
|
|
232
232
|
const nullCmp = nullCompare(lhs, op, rhs);
|
|
233
233
|
if (nullCmp) {
|
|
234
234
|
value = nullCmp;
|
|
235
235
|
}
|
|
236
236
|
else {
|
|
237
|
-
value = (0, utils_1.nullsafeNot)(regexEqual(lhs, rhs) || (0, utils_1.compose)(lhs.value,
|
|
237
|
+
value = (0, utils_1.nullsafeNot)(regexEqual(lhs, rhs) || (0, utils_1.compose)(lhs.value, '=', rhs.value), op);
|
|
238
238
|
}
|
|
239
239
|
break;
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
243
|
return {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
value
|
|
244
|
+
dataType: 'boolean',
|
|
245
|
+
expressionType: (0, malloy_types_1.maxExpressionType)(lhs.expressionType, rhs.expressionType),
|
|
246
|
+
value,
|
|
247
247
|
};
|
|
248
248
|
}
|
|
249
249
|
function compare(fs, left, op, right) {
|
|
@@ -252,13 +252,13 @@ function compare(fs, left, op, right) {
|
|
|
252
252
|
const expressionType = (0, malloy_types_1.maxExpressionType)(lhs.expressionType, rhs.expressionType);
|
|
253
253
|
const noCompare = unsupportError(left, lhs, right, rhs);
|
|
254
254
|
if (noCompare) {
|
|
255
|
-
return { ...noCompare,
|
|
255
|
+
return { ...noCompare, dataType: 'boolean' };
|
|
256
256
|
}
|
|
257
257
|
const value = timeCompare(lhs, op, rhs) || (0, utils_1.compose)(lhs.value, op, rhs.value);
|
|
258
258
|
return {
|
|
259
|
-
|
|
259
|
+
dataType: 'boolean',
|
|
260
260
|
expressionType,
|
|
261
|
-
|
|
261
|
+
value: value,
|
|
262
262
|
};
|
|
263
263
|
}
|
|
264
264
|
function oneOf(op, ...operators) {
|
|
@@ -280,15 +280,15 @@ function numeric(fs, left, op, right) {
|
|
|
280
280
|
return noGo;
|
|
281
281
|
}
|
|
282
282
|
const expressionType = (0, malloy_types_1.maxExpressionType)(lhs.expressionType, rhs.expressionType);
|
|
283
|
-
if (allAre(
|
|
283
|
+
if (allAre('number', lhs, rhs)) {
|
|
284
284
|
return {
|
|
285
|
-
|
|
285
|
+
dataType: 'number',
|
|
286
286
|
expressionType,
|
|
287
|
-
|
|
287
|
+
value: (0, utils_1.compose)(lhs.value, op, rhs.value),
|
|
288
288
|
};
|
|
289
289
|
}
|
|
290
290
|
left.log(`Non numeric('${lhs.dataType},${rhs.dataType}') value with '${op}'`);
|
|
291
|
-
return (0, ast_utils_1.errorFor)(
|
|
291
|
+
return (0, ast_utils_1.errorFor)('numbers required');
|
|
292
292
|
}
|
|
293
293
|
function delta(fs, left, op, right) {
|
|
294
294
|
const lhs = left.getExpression(fs);
|
|
@@ -299,12 +299,12 @@ function delta(fs, left, op, right) {
|
|
|
299
299
|
}
|
|
300
300
|
if ((0, malloy_types_1.isTimeFieldType)(lhs.dataType)) {
|
|
301
301
|
let duration = right;
|
|
302
|
-
if (rhs.dataType !==
|
|
302
|
+
if (rhs.dataType !== 'duration') {
|
|
303
303
|
if ((0, granular_result_1.isGranularResult)(lhs)) {
|
|
304
304
|
duration = new ExprDuration(right, lhs.timeframe);
|
|
305
305
|
}
|
|
306
|
-
else if (lhs.dataType ===
|
|
307
|
-
duration = new ExprDuration(right,
|
|
306
|
+
else if (lhs.dataType === 'date') {
|
|
307
|
+
duration = new ExprDuration(right, 'day');
|
|
308
308
|
}
|
|
309
309
|
else {
|
|
310
310
|
left.log(`Can not offset time by '${rhs.dataType}'`);
|
|
@@ -333,43 +333,43 @@ function applyBinary(fs, left, op, right) {
|
|
|
333
333
|
if ((0, comparison_1.isComparison)(op)) {
|
|
334
334
|
return compare(fs, left, op, right);
|
|
335
335
|
}
|
|
336
|
-
if (oneOf(op,
|
|
336
|
+
if (oneOf(op, '+', '-')) {
|
|
337
337
|
return delta(fs, left, op, right);
|
|
338
338
|
}
|
|
339
|
-
if (oneOf(op,
|
|
339
|
+
if (oneOf(op, '*', '%')) {
|
|
340
340
|
return numeric(fs, left, op, right);
|
|
341
341
|
}
|
|
342
|
-
if (oneOf(op,
|
|
342
|
+
if (oneOf(op, '/')) {
|
|
343
343
|
const num = left.getExpression(fs);
|
|
344
344
|
const denom = right.getExpression(fs);
|
|
345
345
|
const noGo = unsupportError(left, num, right, denom);
|
|
346
346
|
if (noGo) {
|
|
347
|
-
left.log(
|
|
347
|
+
left.log('Cannot operate with unsupported type');
|
|
348
348
|
return noGo;
|
|
349
349
|
}
|
|
350
|
-
if (num.dataType
|
|
351
|
-
left.log(
|
|
350
|
+
if (num.dataType !== 'number') {
|
|
351
|
+
left.log('Numerator for division must be a number');
|
|
352
352
|
}
|
|
353
|
-
else if (denom.dataType
|
|
354
|
-
right.log(
|
|
353
|
+
else if (denom.dataType !== 'number') {
|
|
354
|
+
right.log('Denominator for division must be a number');
|
|
355
355
|
}
|
|
356
356
|
else {
|
|
357
357
|
const div = {
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
358
|
+
type: 'dialect',
|
|
359
|
+
function: 'div',
|
|
360
|
+
numerator: num.value,
|
|
361
|
+
denominator: denom.value,
|
|
362
362
|
};
|
|
363
363
|
return {
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
364
|
+
dataType: 'number',
|
|
365
|
+
expressionType: (0, malloy_types_1.maxExpressionType)(num.expressionType, denom.expressionType),
|
|
366
|
+
value: [div],
|
|
367
367
|
};
|
|
368
368
|
}
|
|
369
|
-
return (0, ast_utils_1.errorFor)(
|
|
369
|
+
return (0, ast_utils_1.errorFor)('divide type mismatch');
|
|
370
370
|
}
|
|
371
371
|
left.log(`Cannot use ${op} operator here`);
|
|
372
|
-
return (0, ast_utils_1.errorFor)(
|
|
372
|
+
return (0, ast_utils_1.errorFor)('applybinary bad operator');
|
|
373
373
|
}
|
|
374
374
|
exports.applyBinary = applyBinary;
|
|
375
375
|
/**
|
|
@@ -377,16 +377,16 @@ exports.applyBinary = applyBinary;
|
|
|
377
377
|
*/
|
|
378
378
|
function unsupportError(l, lhs, r, rhs) {
|
|
379
379
|
const ret = {
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
380
|
+
dataType: lhs.dataType,
|
|
381
|
+
expressionType: (0, malloy_types_1.maxExpressionType)(lhs.expressionType, rhs.expressionType),
|
|
382
|
+
value: ["'unsupported operation'"],
|
|
383
383
|
};
|
|
384
|
-
if (lhs.dataType ===
|
|
385
|
-
l.log(
|
|
386
|
-
return { ...ret,
|
|
384
|
+
if (lhs.dataType === 'unsupported') {
|
|
385
|
+
l.log('Unsupported type not allowed in expression');
|
|
386
|
+
return { ...ret, dataType: rhs.dataType };
|
|
387
387
|
}
|
|
388
|
-
if (rhs.dataType ===
|
|
389
|
-
r.log(
|
|
388
|
+
if (rhs.dataType === 'unsupported') {
|
|
389
|
+
r.log('Unsupported type not allowed in expression');
|
|
390
390
|
return ret;
|
|
391
391
|
}
|
|
392
392
|
return undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FieldDeclaration } from
|
|
2
|
-
import { FieldReferenceElement } from
|
|
3
|
-
import { MalloyElement } from
|
|
1
|
+
import { FieldDeclaration } from '../query-items/field-declaration';
|
|
2
|
+
import { FieldReferenceElement } from '../query-items/field-references';
|
|
3
|
+
import { MalloyElement } from './malloy-element';
|
|
4
4
|
export declare type FieldCollectionMember = FieldReferenceElement | FieldDeclaration;
|
|
5
5
|
export declare function isFieldCollectionMember(el: MalloyElement): el is FieldCollectionMember;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { TurtleDecl } from
|
|
2
|
-
import { Turtles } from
|
|
3
|
-
import { FieldDeclaration } from
|
|
4
|
-
import { Join } from
|
|
5
|
-
import { MalloyElement } from
|
|
1
|
+
import { TurtleDecl } from '../query-properties/nest';
|
|
2
|
+
import { Turtles } from '../source-properties/turtles';
|
|
3
|
+
import { FieldDeclaration } from '../query-items/field-declaration';
|
|
4
|
+
import { Join } from '../query-properties/joins';
|
|
5
|
+
import { MalloyElement } from './malloy-element';
|
|
6
6
|
export declare type FieldDecl = FieldDeclaration | Join | TurtleDecl | Turtles;
|
|
7
7
|
export declare function isFieldDecl(f: MalloyElement): f is FieldDecl;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { Dialect } from
|
|
2
|
-
import { StructDef } from
|
|
3
|
-
import { LookupResult } from
|
|
4
|
-
import { MalloyElement } from
|
|
1
|
+
import { Dialect } from '../../../dialect/dialect';
|
|
2
|
+
import { StructDef } from '../../../model/malloy_types';
|
|
3
|
+
import { LookupResult } from './lookup-result';
|
|
4
|
+
import { MalloyElement } from './malloy-element';
|
|
5
5
|
/**
|
|
6
6
|
* A FieldSpace is a hierarchy of namespaces, where the leaf nodes
|
|
7
7
|
* are fields. A FieldSpace can lookup fields, and generate a StructDef
|
|
8
8
|
*/
|
|
9
9
|
export interface FieldSpace {
|
|
10
|
-
type:
|
|
10
|
+
type: 'fieldSpace';
|
|
11
11
|
structDef(): StructDef;
|
|
12
12
|
emptyStructDef(): StructDef;
|
|
13
13
|
lookup(symbol: FieldName[]): LookupResult;
|