@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,23 +27,23 @@ const time_utils_1 = require("../time-utils");
|
|
|
27
27
|
const expression_def_1 = require("../types/expression-def");
|
|
28
28
|
const utils_1 = require("./utils");
|
|
29
29
|
function isCastType(t) {
|
|
30
|
-
return [
|
|
30
|
+
return ['string', 'number', 'boolean', 'date', 'timestamp'].includes(t);
|
|
31
31
|
}
|
|
32
32
|
exports.isCastType = isCastType;
|
|
33
33
|
class ExprCast extends expression_def_1.ExpressionDef {
|
|
34
34
|
constructor(expr, castType, safe = false) {
|
|
35
|
-
super({
|
|
35
|
+
super({ expr: expr });
|
|
36
36
|
this.expr = expr;
|
|
37
37
|
this.castType = castType;
|
|
38
38
|
this.safe = safe;
|
|
39
|
-
this.elementType =
|
|
39
|
+
this.elementType = 'cast';
|
|
40
40
|
}
|
|
41
41
|
getExpression(fs) {
|
|
42
42
|
const expr = this.expr.getExpression(fs);
|
|
43
43
|
return {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
dataType: this.castType,
|
|
45
|
+
expressionType: expr.expressionType,
|
|
46
|
+
value: (0, utils_1.compressExpr)((0, time_utils_1.castTo)(this.castType, expr.value, this.safe)),
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
49
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Comparison } from
|
|
2
|
-
import { ExprValue } from
|
|
3
|
-
import { ExpressionDef } from
|
|
4
|
-
import { FieldSpace } from
|
|
5
|
-
import { BinaryBoolean } from
|
|
1
|
+
import { Comparison } from '../types/comparison';
|
|
2
|
+
import { ExprValue } from '../types/expr-value';
|
|
3
|
+
import { ExpressionDef } from '../types/expression-def';
|
|
4
|
+
import { FieldSpace } from '../types/field-space';
|
|
5
|
+
import { BinaryBoolean } from './binary-boolean';
|
|
6
6
|
export declare class ExprCompare extends BinaryBoolean<Comparison> {
|
|
7
7
|
elementType: string;
|
|
8
8
|
constructor(left: ExpressionDef, op: Comparison, right: ExpressionDef);
|
|
@@ -28,19 +28,19 @@ const granular_result_1 = require("../types/granular-result");
|
|
|
28
28
|
const binary_boolean_1 = require("./binary-boolean");
|
|
29
29
|
const expr_granular_time_1 = require("./expr-granular-time");
|
|
30
30
|
const compareTypes = {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
'~': [fragtype_utils_1.FT.stringT],
|
|
32
|
+
'!~': [fragtype_utils_1.FT.stringT],
|
|
33
|
+
'<': [fragtype_utils_1.FT.numberT, fragtype_utils_1.FT.stringT, fragtype_utils_1.FT.dateT, fragtype_utils_1.FT.timestampT],
|
|
34
|
+
'<=': [fragtype_utils_1.FT.numberT, fragtype_utils_1.FT.stringT, fragtype_utils_1.FT.dateT, fragtype_utils_1.FT.timestampT],
|
|
35
|
+
'=': [fragtype_utils_1.FT.numberT, fragtype_utils_1.FT.stringT, fragtype_utils_1.FT.dateT, fragtype_utils_1.FT.timestampT],
|
|
36
|
+
'!=': [fragtype_utils_1.FT.numberT, fragtype_utils_1.FT.stringT, fragtype_utils_1.FT.dateT, fragtype_utils_1.FT.timestampT],
|
|
37
|
+
'>=': [fragtype_utils_1.FT.numberT, fragtype_utils_1.FT.stringT, fragtype_utils_1.FT.dateT, fragtype_utils_1.FT.timestampT],
|
|
38
|
+
'>': [fragtype_utils_1.FT.numberT, fragtype_utils_1.FT.stringT, fragtype_utils_1.FT.dateT, fragtype_utils_1.FT.timestampT],
|
|
39
39
|
};
|
|
40
40
|
class ExprCompare extends binary_boolean_1.BinaryBoolean {
|
|
41
41
|
constructor(left, op, right) {
|
|
42
42
|
super(left, op, right);
|
|
43
|
-
this.elementType =
|
|
43
|
+
this.elementType = 'a<=>b';
|
|
44
44
|
this.legalChildTypes = compareTypes[op];
|
|
45
45
|
}
|
|
46
46
|
getExpression(fs) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ExprAggregateFunction } from
|
|
2
|
-
import { ExpressionDef } from
|
|
1
|
+
import { ExprAggregateFunction } from './expr-aggregate-function';
|
|
2
|
+
import { ExpressionDef } from '../types/expression-def';
|
|
3
3
|
export declare class ExprCountDistinct extends ExprAggregateFunction {
|
|
4
4
|
legalChildTypes: import("../types/type-desc").TypeDesc[];
|
|
5
5
|
constructor(expr: ExpressionDef);
|
|
@@ -27,7 +27,7 @@ const fragtype_utils_1 = require("../fragtype-utils");
|
|
|
27
27
|
const expr_aggregate_function_1 = require("./expr-aggregate-function");
|
|
28
28
|
class ExprCountDistinct extends expr_aggregate_function_1.ExprAggregateFunction {
|
|
29
29
|
constructor(expr) {
|
|
30
|
-
super(
|
|
30
|
+
super('count_distinct', expr);
|
|
31
31
|
this.legalChildTypes = [fragtype_utils_1.FT.numberT, fragtype_utils_1.FT.stringT, fragtype_utils_1.FT.dateT, fragtype_utils_1.FT.timestampT];
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { FieldReference } from
|
|
2
|
-
import { ExprValue } from
|
|
3
|
-
import { FieldSpace } from
|
|
4
|
-
import { ExprAggregateFunction } from
|
|
1
|
+
import { FieldReference } from '../query-items/field-references';
|
|
2
|
+
import { ExprValue } from '../types/expr-value';
|
|
3
|
+
import { FieldSpace } from '../types/field-space';
|
|
4
|
+
import { ExprAggregateFunction } from './expr-aggregate-function';
|
|
5
5
|
export declare class ExprCount extends ExprAggregateFunction {
|
|
6
6
|
readonly source?: FieldReference | undefined;
|
|
7
7
|
elementType: string;
|
|
@@ -26,30 +26,30 @@ exports.ExprCount = void 0;
|
|
|
26
26
|
const expr_aggregate_function_1 = require("./expr-aggregate-function");
|
|
27
27
|
class ExprCount extends expr_aggregate_function_1.ExprAggregateFunction {
|
|
28
28
|
constructor(source) {
|
|
29
|
-
super(
|
|
29
|
+
super('count');
|
|
30
30
|
this.source = source;
|
|
31
|
-
this.elementType =
|
|
32
|
-
this.has({
|
|
31
|
+
this.elementType = 'count';
|
|
32
|
+
this.has({ source: source });
|
|
33
33
|
}
|
|
34
34
|
defaultFieldName() {
|
|
35
35
|
if (this.source) {
|
|
36
|
-
return
|
|
36
|
+
return 'count_' + this.source.nameString;
|
|
37
37
|
}
|
|
38
38
|
return undefined;
|
|
39
39
|
}
|
|
40
40
|
getExpression(_fs) {
|
|
41
41
|
const ret = {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
type: 'aggregate',
|
|
43
|
+
function: 'count',
|
|
44
|
+
e: [],
|
|
45
45
|
};
|
|
46
46
|
if (this.source) {
|
|
47
47
|
ret.structPath = this.source.refString;
|
|
48
48
|
}
|
|
49
49
|
return {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
dataType: 'number',
|
|
51
|
+
expressionType: 'aggregate',
|
|
52
|
+
value: [ret],
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
55
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Filter } from
|
|
2
|
-
import { ExprValue } from
|
|
3
|
-
import { ExpressionDef } from
|
|
4
|
-
import { FieldSpace } from
|
|
1
|
+
import { Filter } from '../query-properties/filters';
|
|
2
|
+
import { ExprValue } from '../types/expr-value';
|
|
3
|
+
import { ExpressionDef } from '../types/expression-def';
|
|
4
|
+
import { FieldSpace } from '../types/field-space';
|
|
5
5
|
export declare class ExprFilter extends ExpressionDef {
|
|
6
6
|
readonly expr: ExpressionDef;
|
|
7
7
|
readonly filter: Filter;
|
|
@@ -29,10 +29,10 @@ const fragtype_utils_1 = require("../fragtype-utils");
|
|
|
29
29
|
const expression_def_1 = require("../types/expression-def");
|
|
30
30
|
class ExprFilter extends expression_def_1.ExpressionDef {
|
|
31
31
|
constructor(expr, filter) {
|
|
32
|
-
super({
|
|
32
|
+
super({ expr: expr, filter: filter });
|
|
33
33
|
this.expr = expr;
|
|
34
34
|
this.filter = filter;
|
|
35
|
-
this.elementType =
|
|
35
|
+
this.elementType = 'filtered expression';
|
|
36
36
|
this.legalChildTypes = fragtype_utils_1.FT.anyAtomicT;
|
|
37
37
|
}
|
|
38
38
|
getExpression(fs) {
|
|
@@ -40,29 +40,29 @@ class ExprFilter extends expression_def_1.ExpressionDef {
|
|
|
40
40
|
const resultExpr = this.expr.getExpression(fs);
|
|
41
41
|
for (const cond of testList) {
|
|
42
42
|
if ((0, malloy_types_1.expressionIsCalculation)(cond.expressionType)) {
|
|
43
|
-
this.filter.log(
|
|
44
|
-
return (0, ast_utils_1.errorFor)(
|
|
43
|
+
this.filter.log('Cannot filter a field with an aggregate or analytical computation');
|
|
44
|
+
return (0, ast_utils_1.errorFor)('no filter on aggregate');
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
if (resultExpr.expressionType ===
|
|
47
|
+
if (resultExpr.expressionType === 'scalar') {
|
|
48
48
|
// TODO could log a warning, but I have a problem with the
|
|
49
49
|
// idea of warnings, so for now ...
|
|
50
50
|
return resultExpr;
|
|
51
51
|
}
|
|
52
|
-
if (this.typeCheck(this.expr, { ...resultExpr,
|
|
52
|
+
if (this.typeCheck(this.expr, { ...resultExpr, expressionType: 'scalar' })) {
|
|
53
53
|
return {
|
|
54
54
|
...resultExpr,
|
|
55
|
-
|
|
55
|
+
value: [
|
|
56
56
|
{
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
]
|
|
57
|
+
type: 'filterExpression',
|
|
58
|
+
e: resultExpr.value,
|
|
59
|
+
filterList: testList,
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
64
|
this.expr.log(`Cannot filter '${resultExpr.dataType}' data`);
|
|
65
|
-
return (0, ast_utils_1.errorFor)(
|
|
65
|
+
return (0, ast_utils_1.errorFor)('cannot filter type');
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
exports.ExprFilter = ExprFilter;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ExprValue } from
|
|
2
|
-
import { ExpressionDef } from
|
|
3
|
-
import { FieldSpace } from
|
|
1
|
+
import { ExprValue } from '../types/expr-value';
|
|
2
|
+
import { ExpressionDef } from '../types/expression-def';
|
|
3
|
+
import { FieldSpace } from '../types/field-space';
|
|
4
4
|
export declare class ExprFunc extends ExpressionDef {
|
|
5
5
|
readonly name: string;
|
|
6
6
|
readonly args: ExpressionDef[];
|
|
@@ -28,34 +28,34 @@ const expression_def_1 = require("../types/expression-def");
|
|
|
28
28
|
const utils_1 = require("./utils");
|
|
29
29
|
class ExprFunc extends expression_def_1.ExpressionDef {
|
|
30
30
|
constructor(name, args) {
|
|
31
|
-
super({
|
|
31
|
+
super({ args: args });
|
|
32
32
|
this.name = name;
|
|
33
33
|
this.args = args;
|
|
34
|
-
this.elementType =
|
|
34
|
+
this.elementType = 'function call()';
|
|
35
35
|
}
|
|
36
36
|
getExpression(fs) {
|
|
37
37
|
var _a, _b, _c;
|
|
38
|
-
let expressionType =
|
|
38
|
+
let expressionType = 'scalar';
|
|
39
39
|
let collectType;
|
|
40
40
|
const funcCall = [`${this.name}(`];
|
|
41
41
|
for (const fexpr of this.args) {
|
|
42
42
|
const expr = fexpr.getExpression(fs);
|
|
43
43
|
expressionType = (0, malloy_types_1.maxExpressionType)(expressionType, expr.expressionType);
|
|
44
44
|
if (collectType) {
|
|
45
|
-
funcCall.push(
|
|
45
|
+
funcCall.push(',');
|
|
46
46
|
}
|
|
47
47
|
else {
|
|
48
48
|
collectType = expr.dataType;
|
|
49
49
|
}
|
|
50
50
|
funcCall.push(...expr.value);
|
|
51
51
|
}
|
|
52
|
-
funcCall.push(
|
|
52
|
+
funcCall.push(')');
|
|
53
53
|
const dialect = fs.dialectObj();
|
|
54
|
-
const dataType = (_c = (_b = (_a = dialect === null || dialect === void 0 ? void 0 : dialect.getFunctionInfo(this.name)) === null || _a === void 0 ? void 0 : _a.returnType) !== null && _b !== void 0 ? _b : collectType) !== null && _c !== void 0 ? _c :
|
|
54
|
+
const dataType = (_c = (_b = (_a = dialect === null || dialect === void 0 ? void 0 : dialect.getFunctionInfo(this.name)) === null || _a === void 0 ? void 0 : _a.returnType) !== null && _b !== void 0 ? _b : collectType) !== null && _c !== void 0 ? _c : 'number';
|
|
55
55
|
return {
|
|
56
|
-
|
|
56
|
+
dataType: dataType,
|
|
57
57
|
expressionType,
|
|
58
|
-
|
|
58
|
+
value: (0, utils_1.compressExpr)(funcCall),
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
61
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { TimestampUnit } from
|
|
2
|
-
import { ExprValue } from
|
|
3
|
-
import { ExpressionDef } from
|
|
4
|
-
import { FieldSpace } from
|
|
1
|
+
import { TimestampUnit } from '../../../model/malloy_types';
|
|
2
|
+
import { ExprValue } from '../types/expr-value';
|
|
3
|
+
import { ExpressionDef } from '../types/expression-def';
|
|
4
|
+
import { FieldSpace } from '../types/field-space';
|
|
5
5
|
/**
|
|
6
6
|
* GranularTime is a moment in time which ALSO has a "granularity"
|
|
7
7
|
* commonly this are created by applying ".datePart" to an expression
|
|
@@ -39,11 +39,11 @@ const range_1 = require("./range");
|
|
|
39
39
|
*/
|
|
40
40
|
class ExprGranularTime extends expression_def_1.ExpressionDef {
|
|
41
41
|
constructor(expr, units, truncate) {
|
|
42
|
-
super({
|
|
42
|
+
super({ expr: expr });
|
|
43
43
|
this.expr = expr;
|
|
44
44
|
this.units = units;
|
|
45
45
|
this.truncate = truncate;
|
|
46
|
-
this.elementType =
|
|
46
|
+
this.elementType = 'granularTime';
|
|
47
47
|
this.legalChildTypes = [fragtype_utils_1.FT.timestampT, fragtype_utils_1.FT.dateT];
|
|
48
48
|
}
|
|
49
49
|
granular() {
|
|
@@ -55,29 +55,29 @@ class ExprGranularTime extends expression_def_1.ExpressionDef {
|
|
|
55
55
|
if ((0, malloy_types_1.isTimeFieldType)(exprVal.dataType)) {
|
|
56
56
|
const tsVal = {
|
|
57
57
|
...exprVal,
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
dataType: exprVal.dataType,
|
|
59
|
+
timeframe: timeframe,
|
|
60
60
|
};
|
|
61
61
|
if (this.truncate) {
|
|
62
62
|
tsVal.value = [
|
|
63
63
|
{
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
64
|
+
type: 'dialect',
|
|
65
|
+
function: 'trunc',
|
|
66
|
+
expr: { value: exprVal.value, valueType: exprVal.dataType },
|
|
67
|
+
units: timeframe,
|
|
68
|
+
},
|
|
69
69
|
];
|
|
70
70
|
}
|
|
71
71
|
return tsVal;
|
|
72
72
|
}
|
|
73
73
|
this.log(`Cannot do time truncation on type '${exprVal.dataType}'`);
|
|
74
|
-
return (0, ast_utils_1.errorFor)(
|
|
74
|
+
return (0, ast_utils_1.errorFor)('granularity typecheck');
|
|
75
75
|
}
|
|
76
76
|
apply(fs, op, left) {
|
|
77
77
|
const rangeType = this.getExpression(fs).dataType;
|
|
78
78
|
const _valueType = left.getExpression(fs).dataType;
|
|
79
|
-
const granularityType = (0, malloy_types_1.isDateUnit)(this.units) ?
|
|
80
|
-
if (rangeType
|
|
79
|
+
const granularityType = (0, malloy_types_1.isDateUnit)(this.units) ? 'date' : 'timestamp';
|
|
80
|
+
if (rangeType === 'date' && granularityType === 'date') {
|
|
81
81
|
return this.dateRange(fs, op, left);
|
|
82
82
|
}
|
|
83
83
|
return this.timestampRange(fs, op, left);
|
|
@@ -99,16 +99,16 @@ class ExprGranularTime extends expression_def_1.ExpressionDef {
|
|
|
99
99
|
}
|
|
100
100
|
timestampRange(fs, op, expr) {
|
|
101
101
|
const begin = this.getExpression(fs);
|
|
102
|
-
const beginTime = expr_time_1.ExprTime.fromValue(
|
|
103
|
-
const endTime = new expr_time_1.ExprTime(
|
|
102
|
+
const beginTime = expr_time_1.ExprTime.fromValue('timestamp', begin);
|
|
103
|
+
const endTime = new expr_time_1.ExprTime('timestamp', (0, time_utils_1.timeOffset)('timestamp', begin.value, '+', (0, malloy_types_1.mkExpr) `1`, this.units), begin.expressionType);
|
|
104
104
|
const range = new range_1.Range(beginTime, endTime);
|
|
105
105
|
return range.apply(fs, op, expr);
|
|
106
106
|
}
|
|
107
107
|
dateRange(fs, op, expr) {
|
|
108
108
|
const begin = this.getExpression(fs);
|
|
109
|
-
const beginTime = new expr_time_1.ExprTime(
|
|
110
|
-
const endAt = (0, time_utils_1.timeOffset)(
|
|
111
|
-
const end = new expr_time_1.ExprTime(
|
|
109
|
+
const beginTime = new expr_time_1.ExprTime('date', begin.value, begin.expressionType);
|
|
110
|
+
const endAt = (0, time_utils_1.timeOffset)('date', begin.value, '+', ['1'], this.units);
|
|
111
|
+
const end = new expr_time_1.ExprTime('date', endAt, begin.expressionType);
|
|
112
112
|
const range = new range_1.Range(beginTime, end);
|
|
113
113
|
return range.apply(fs, op, expr);
|
|
114
114
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ExprValue } from
|
|
2
|
-
import { FieldReference } from
|
|
3
|
-
import { FieldSpace } from
|
|
4
|
-
import { ExpressionDef } from
|
|
1
|
+
import { ExprValue } from '../types/expr-value';
|
|
2
|
+
import { FieldReference } from '../query-items/field-references';
|
|
3
|
+
import { FieldSpace } from '../types/field-space';
|
|
4
|
+
import { ExpressionDef } from '../types/expression-def';
|
|
5
5
|
export declare class ExprIdReference extends ExpressionDef {
|
|
6
6
|
readonly fieldReference: FieldReference;
|
|
7
7
|
elementType: string;
|
|
@@ -31,8 +31,8 @@ class ExprIdReference extends expression_def_1.ExpressionDef {
|
|
|
31
31
|
constructor(fieldReference) {
|
|
32
32
|
super();
|
|
33
33
|
this.fieldReference = fieldReference;
|
|
34
|
-
this.elementType =
|
|
35
|
-
this.has({
|
|
34
|
+
this.elementType = 'ExpressionIdReference';
|
|
35
|
+
this.has({ fieldPath: fieldReference });
|
|
36
36
|
}
|
|
37
37
|
get refString() {
|
|
38
38
|
return this.fieldReference.refString;
|
|
@@ -40,7 +40,7 @@ class ExprIdReference extends expression_def_1.ExpressionDef {
|
|
|
40
40
|
getExpression(fs) {
|
|
41
41
|
const def = this.fieldReference.getField(fs);
|
|
42
42
|
if (def.found) {
|
|
43
|
-
const value = [{
|
|
43
|
+
const value = [{ type: def.found.refType, path: this.refString }];
|
|
44
44
|
const td = def.found.typeDesc();
|
|
45
45
|
return { ...td, value };
|
|
46
46
|
}
|
|
@@ -54,15 +54,15 @@ class ExprIdReference extends expression_def_1.ExpressionDef {
|
|
|
54
54
|
if ((0, malloy_types_1.isConditionParameter)(cParam)) {
|
|
55
55
|
const lval = expr.getExpression(fs);
|
|
56
56
|
return {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
dataType: 'boolean',
|
|
58
|
+
expressionType: lval.expressionType,
|
|
59
|
+
value: [
|
|
60
60
|
{
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
]
|
|
61
|
+
type: 'apply',
|
|
62
|
+
value: lval.value,
|
|
63
|
+
to: [{ type: 'parameter', path: this.refString }],
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
68
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BinaryBoolean } from
|
|
2
|
-
export declare class ExprLogicalOp extends BinaryBoolean<
|
|
1
|
+
import { BinaryBoolean } from './binary-boolean';
|
|
2
|
+
export declare class ExprLogicalOp extends BinaryBoolean<'and' | 'or'> {
|
|
3
3
|
elementType: string;
|
|
4
4
|
legalChildTypes: import("../types/type-desc").TypeDesc[];
|
|
5
5
|
}
|
|
@@ -28,7 +28,7 @@ const fragtype_utils_1 = require("../fragtype-utils");
|
|
|
28
28
|
class ExprLogicalOp extends binary_boolean_1.BinaryBoolean {
|
|
29
29
|
constructor() {
|
|
30
30
|
super(...arguments);
|
|
31
|
-
this.elementType =
|
|
31
|
+
this.elementType = 'logical operator';
|
|
32
32
|
this.legalChildTypes = [fragtype_utils_1.FT.boolT, fragtype_utils_1.FT.aggregateBoolT];
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ExprValue } from
|
|
2
|
-
import { FieldValueType } from
|
|
3
|
-
import { ExprAggregateFunction } from
|
|
4
|
-
import { ExpressionDef } from
|
|
1
|
+
import { ExprValue } from '../types/expr-value';
|
|
2
|
+
import { FieldValueType } from '../types/type-desc';
|
|
3
|
+
import { ExprAggregateFunction } from './expr-aggregate-function';
|
|
4
|
+
import { ExpressionDef } from '../types/expression-def';
|
|
5
5
|
export declare class ExprMax extends ExprAggregateFunction {
|
|
6
6
|
legalChildTypes: import("../types/type-desc").TypeDesc[];
|
|
7
7
|
constructor(expr: ExpressionDef);
|
|
@@ -27,7 +27,7 @@ const fragtype_utils_1 = require("../fragtype-utils");
|
|
|
27
27
|
const expr_aggregate_function_1 = require("./expr-aggregate-function");
|
|
28
28
|
class ExprMax extends expr_aggregate_function_1.ExprAggregateFunction {
|
|
29
29
|
constructor(expr) {
|
|
30
|
-
super(
|
|
30
|
+
super('max', expr);
|
|
31
31
|
this.legalChildTypes = [fragtype_utils_1.FT.numberT, fragtype_utils_1.FT.stringT, fragtype_utils_1.FT.dateT, fragtype_utils_1.FT.timestampT];
|
|
32
32
|
}
|
|
33
33
|
returns(forExpression) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ExprValue } from
|
|
2
|
-
import { FieldValueType } from
|
|
3
|
-
import { ExprAggregateFunction } from
|
|
4
|
-
import { ExpressionDef } from
|
|
1
|
+
import { ExprValue } from '../types/expr-value';
|
|
2
|
+
import { FieldValueType } from '../types/type-desc';
|
|
3
|
+
import { ExprAggregateFunction } from './expr-aggregate-function';
|
|
4
|
+
import { ExpressionDef } from '../types/expression-def';
|
|
5
5
|
export declare class ExprMin extends ExprAggregateFunction {
|
|
6
6
|
legalChildTypes: import("../types/type-desc").TypeDesc[];
|
|
7
7
|
constructor(expr: ExpressionDef);
|
|
@@ -27,7 +27,7 @@ const fragtype_utils_1 = require("../fragtype-utils");
|
|
|
27
27
|
const expr_aggregate_function_1 = require("./expr-aggregate-function");
|
|
28
28
|
class ExprMin extends expr_aggregate_function_1.ExprAggregateFunction {
|
|
29
29
|
constructor(expr) {
|
|
30
|
-
super(
|
|
30
|
+
super('min', expr);
|
|
31
31
|
this.legalChildTypes = [fragtype_utils_1.FT.numberT, fragtype_utils_1.FT.stringT, fragtype_utils_1.FT.dateT, fragtype_utils_1.FT.timestampT];
|
|
32
32
|
}
|
|
33
33
|
returns(forExpression) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ExprValue } from
|
|
2
|
-
import { ExpressionDef } from
|
|
3
|
-
import { FieldSpace } from
|
|
1
|
+
import { ExprValue } from '../types/expr-value';
|
|
2
|
+
import { ExpressionDef } from '../types/expression-def';
|
|
3
|
+
import { FieldSpace } from '../types/field-space';
|
|
4
4
|
export declare class ExprMinus extends ExpressionDef {
|
|
5
5
|
readonly expr: ExpressionDef;
|
|
6
6
|
elementType: string;
|
|
@@ -28,20 +28,20 @@ const fragtype_utils_1 = require("../fragtype-utils");
|
|
|
28
28
|
const expression_def_1 = require("../types/expression-def");
|
|
29
29
|
class ExprMinus extends expression_def_1.ExpressionDef {
|
|
30
30
|
constructor(expr) {
|
|
31
|
-
super({
|
|
31
|
+
super({ expr: expr });
|
|
32
32
|
this.expr = expr;
|
|
33
|
-
this.elementType =
|
|
33
|
+
this.elementType = 'unary minus';
|
|
34
34
|
this.legalChildTypes = [fragtype_utils_1.FT.numberT];
|
|
35
35
|
}
|
|
36
36
|
getExpression(fs) {
|
|
37
37
|
const expr = this.expr.getExpression(fs);
|
|
38
38
|
if (this.typeCheck(this.expr, expr)) {
|
|
39
39
|
if (expr.value.length > 1) {
|
|
40
|
-
return { ...expr,
|
|
40
|
+
return { ...expr, value: ['-(', ...expr.value, ')'] };
|
|
41
41
|
}
|
|
42
|
-
return { ...expr,
|
|
42
|
+
return { ...expr, value: ['-', ...expr.value] };
|
|
43
43
|
}
|
|
44
|
-
return (0, ast_utils_1.errorFor)(
|
|
44
|
+
return (0, ast_utils_1.errorFor)('negate requires number');
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
exports.ExprMinus = ExprMinus;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BinaryNumeric } from
|
|
2
|
-
export declare class ExprMulDiv extends BinaryNumeric<
|
|
1
|
+
import { BinaryNumeric } from './binary-numeric';
|
|
2
|
+
export declare class ExprMulDiv extends BinaryNumeric<'*' | '/' | '%'> {
|
|
3
3
|
elementType: string;
|
|
4
4
|
}
|
|
@@ -27,7 +27,7 @@ const binary_numeric_1 = require("./binary-numeric");
|
|
|
27
27
|
class ExprMulDiv extends binary_numeric_1.BinaryNumeric {
|
|
28
28
|
constructor() {
|
|
29
29
|
super(...arguments);
|
|
30
|
-
this.elementType =
|
|
30
|
+
this.elementType = '*/%';
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
exports.ExprMulDiv = ExprMulDiv;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ExprValue } from
|
|
2
|
-
import { ExpressionDef } from
|
|
3
|
-
import { FieldSpace } from
|
|
4
|
-
import { Unary } from
|
|
1
|
+
import { ExprValue } from '../types/expr-value';
|
|
2
|
+
import { ExpressionDef } from '../types/expression-def';
|
|
3
|
+
import { FieldSpace } from '../types/field-space';
|
|
4
|
+
import { Unary } from './unary';
|
|
5
5
|
export declare class ExprNot extends Unary {
|
|
6
6
|
elementType: string;
|
|
7
7
|
legalChildTypes: import("../types/type-desc").TypeDesc[];
|
|
@@ -29,7 +29,7 @@ const utils_1 = require("./utils");
|
|
|
29
29
|
class ExprNot extends unary_1.Unary {
|
|
30
30
|
constructor(expr) {
|
|
31
31
|
super(expr);
|
|
32
|
-
this.elementType =
|
|
32
|
+
this.elementType = 'not';
|
|
33
33
|
this.legalChildTypes = [fragtype_utils_1.FT.boolT, fragtype_utils_1.FT.nullT];
|
|
34
34
|
}
|
|
35
35
|
getExpression(fs) {
|
|
@@ -37,8 +37,8 @@ class ExprNot extends unary_1.Unary {
|
|
|
37
37
|
const doNot = this.typeCheck(this.expr, notThis);
|
|
38
38
|
return {
|
|
39
39
|
...notThis,
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
dataType: 'boolean',
|
|
41
|
+
value: doNot ? (0, utils_1.nullsafeNot)(notThis.value) : ['false'],
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ExprValue } from
|
|
2
|
-
import { FieldSpace } from
|
|
3
|
-
import { ExpressionDef } from
|
|
1
|
+
import { ExprValue } from '../types/expr-value';
|
|
2
|
+
import { FieldSpace } from '../types/field-space';
|
|
3
|
+
import { ExpressionDef } from '../types/expression-def';
|
|
4
4
|
export declare class ExprNow extends ExpressionDef {
|
|
5
5
|
elementType: string;
|
|
6
6
|
getExpression(_fs: FieldSpace): ExprValue;
|
|
@@ -27,18 +27,18 @@ const expression_def_1 = require("../types/expression-def");
|
|
|
27
27
|
class ExprNow extends expression_def_1.ExpressionDef {
|
|
28
28
|
constructor() {
|
|
29
29
|
super(...arguments);
|
|
30
|
-
this.elementType =
|
|
30
|
+
this.elementType = 'timestamp';
|
|
31
31
|
}
|
|
32
32
|
getExpression(_fs) {
|
|
33
33
|
return {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
dataType: 'timestamp',
|
|
35
|
+
expressionType: 'scalar',
|
|
36
|
+
value: [
|
|
37
37
|
{
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
]
|
|
38
|
+
type: 'dialect',
|
|
39
|
+
function: 'now',
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
}
|