@malloydata/malloy 0.0.279 → 0.0.281
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/annotation.js +3 -4
- package/dist/api/asynchronous.js +21 -12
- package/dist/api/core.js +29 -20
- package/dist/api/index.js +17 -7
- package/dist/api/sessioned.js +20 -11
- package/dist/api/stateless.js +20 -11
- package/dist/api/util.js +6 -6
- package/dist/connection_utils.js +1 -2
- package/dist/dialect/dialect.js +3 -3
- package/dist/dialect/dialect_map.js +3 -4
- package/dist/dialect/functions/malloy_standard_functions.d.ts +1 -0
- package/dist/dialect/functions/malloy_standard_functions.js +9 -3
- package/dist/dialect/functions/util.d.ts +1 -1
- package/dist/dialect/functions/util.js +21 -22
- package/dist/dialect/trino/dialect_functions.js +18 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +19 -8
- package/dist/lang/ast/ast-utils.js +1 -2
- package/dist/lang/ast/expressions/binary-boolean.js +17 -7
- package/dist/lang/ast/expressions/binary-numeric.js +17 -7
- package/dist/lang/ast/expressions/boolean.js +17 -7
- package/dist/lang/ast/expressions/case.js +17 -7
- package/dist/lang/ast/expressions/expr-aggregate-function.js +17 -7
- package/dist/lang/ast/expressions/expr-array-literal.js +17 -7
- package/dist/lang/ast/expressions/expr-coalesce.js +17 -7
- package/dist/lang/ast/expressions/expr-compare.js +17 -7
- package/dist/lang/ast/expressions/expr-count-distinct.js +17 -7
- package/dist/lang/ast/expressions/expr-func.js +27 -25
- package/dist/lang/ast/expressions/expr-granular-time.js +17 -7
- package/dist/lang/ast/expressions/expr-logical-op.js +17 -7
- package/dist/lang/ast/expressions/expr-max.js +17 -7
- package/dist/lang/ast/expressions/expr-min.js +17 -7
- package/dist/lang/ast/expressions/expr-minus.js +17 -7
- package/dist/lang/ast/expressions/expr-not.js +17 -7
- package/dist/lang/ast/expressions/expr-props.d.ts +36 -36
- package/dist/lang/ast/expressions/expr-props.js +17 -7
- package/dist/lang/ast/expressions/expr-record-literal.js +17 -7
- package/dist/lang/ast/expressions/expr-ungroup.js +17 -7
- package/dist/lang/ast/expressions/for-range.js +17 -7
- package/dist/lang/ast/expressions/pick-when.js +17 -7
- package/dist/lang/ast/field-space/dynamic-space.js +17 -7
- package/dist/lang/ast/field-space/include-utils.js +2 -3
- package/dist/lang/ast/field-space/query-spaces.js +17 -7
- package/dist/lang/ast/field-space/reference-field.js +17 -7
- package/dist/lang/ast/field-space/struct-space-field-base.js +17 -7
- package/dist/lang/ast/field-space/view-field.d.ts +31 -31
- package/dist/lang/ast/field-space/view-field.js +17 -7
- package/dist/lang/ast/query-items/field-declaration.js +17 -7
- package/dist/lang/ast/query-items/typecheck_utils.js +8 -9
- package/dist/lang/ast/query-properties/nest.js +17 -7
- package/dist/lang/ast/query-utils.js +3 -4
- package/dist/lang/ast/struct-utils.js +3 -4
- package/dist/lang/ast/time-utils.js +4 -5
- package/dist/lang/ast/typedesc-utils.js +7 -7
- package/dist/lang/ast/types/binary_operators.js +3 -4
- package/dist/lang/ast/types/expr-value.js +7 -8
- package/dist/lang/ast/types/expression-def.js +21 -11
- package/dist/lang/ast/types/field-collection-member.js +1 -2
- package/dist/lang/ast/types/field-prop-statement.js +1 -2
- package/dist/lang/ast/types/global-name-space.js +2 -2
- package/dist/lang/ast/types/granular-result.js +1 -2
- package/dist/lang/ast/types/malloy-element.js +3 -3
- package/dist/lang/ast/types/noteable.js +3 -4
- package/dist/lang/ast/types/query-element.js +1 -2
- package/dist/lang/ast/types/query-extend-property.js +1 -2
- package/dist/lang/ast/types/query-property.js +1 -2
- package/dist/lang/ast/types/source-property.js +1 -2
- package/dist/lang/ast/types/space-entry.js +2 -2
- package/dist/lang/ast/types/space-param.js +17 -7
- package/dist/lang/ast/view-elements/refine-utils.js +1 -2
- package/dist/lang/field-utils.js +2 -3
- package/dist/lang/lib/Malloy/MalloyLexer.js +17 -7
- package/dist/lang/lib/Malloy/MalloyParser.js +17 -7
- package/dist/lang/malloy-to-ast.js +17 -7
- package/dist/lang/malloy-to-stable-query.js +19 -9
- package/dist/lang/parse-log.js +2 -2
- package/dist/lang/parse-malloy.js +17 -7
- package/dist/lang/parse-tree-walkers/document-completion-walker.js +1 -2
- package/dist/lang/parse-tree-walkers/document-help-context-walker.js +1 -2
- package/dist/lang/parse-tree-walkers/document-symbol-walker.js +1 -2
- package/dist/lang/parse-tree-walkers/explore-query-walker.js +2 -2
- package/dist/lang/parse-tree-walkers/find-external-references.js +3 -4
- package/dist/lang/parse-tree-walkers/find-table-path-walker.js +1 -2
- package/dist/lang/parse-tree-walkers/model-annotation-walker.js +1 -2
- package/dist/lang/parse-utils.js +8 -9
- package/dist/lang/run-malloy-parser.js +1 -2
- package/dist/lang/test/expr-to-str.js +1 -2
- package/dist/lang/test/test-translator.js +18 -18
- package/dist/lang/translate-response.js +1 -2
- package/dist/lang/utils.js +6 -7
- package/dist/malloy.d.ts +0 -2
- package/dist/model/composite_source_utils.js +17 -18
- package/dist/model/filter_compilers.d.ts +1 -1
- package/dist/model/malloy_query.js +3 -3
- package/dist/model/malloy_types.d.ts +1 -3
- package/dist/model/malloy_types.js +64 -65
- package/dist/model/materialization/utils.js +2 -3
- package/dist/model/sql_block.js +2 -3
- package/dist/model/utils.js +10 -10
- package/dist/test/index.d.ts +0 -1
- package/dist/test/index.js +3 -4
- package/dist/to_stable.d.ts +1 -0
- package/dist/to_stable.js +41 -34
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
|
@@ -23,16 +23,34 @@
|
|
|
23
23
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
24
24
|
*/
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
26
|
+
exports.arg = arg;
|
|
27
|
+
exports.spread = spread;
|
|
28
|
+
exports.sql = sql;
|
|
29
|
+
exports.constant = constant;
|
|
30
|
+
exports.output = output;
|
|
31
|
+
exports.literal = literal;
|
|
32
|
+
exports.variadicParam = variadicParam;
|
|
33
|
+
exports.param = param;
|
|
34
|
+
exports.makeParam = makeParam;
|
|
35
|
+
exports.maxScalar = maxScalar;
|
|
36
|
+
exports.maxAggregate = maxAggregate;
|
|
37
|
+
exports.anyExprType = anyExprType;
|
|
38
|
+
exports.maxUngroupedAggregate = maxUngroupedAggregate;
|
|
39
|
+
exports.maxAnalytic = maxAnalytic;
|
|
40
|
+
exports.minScalar = minScalar;
|
|
41
|
+
exports.minAggregate = minAggregate;
|
|
42
|
+
exports.minAnalytic = minAnalytic;
|
|
43
|
+
exports.overload = overload;
|
|
44
|
+
exports.expandBlueprintMap = expandBlueprintMap;
|
|
45
|
+
exports.expandOverrideMapFromBase = expandOverrideMapFromBase;
|
|
46
|
+
exports.def = def;
|
|
27
47
|
const malloy_types_1 = require("../../model/malloy_types");
|
|
28
48
|
function arg(name) {
|
|
29
49
|
return { node: 'function_parameter', name };
|
|
30
50
|
}
|
|
31
|
-
exports.arg = arg;
|
|
32
51
|
function spread(e, prefix = undefined, suffix = undefined) {
|
|
33
52
|
return { node: 'spread', e, prefix, suffix };
|
|
34
53
|
}
|
|
35
|
-
exports.spread = spread;
|
|
36
54
|
function sql(strings, ...subExprs) {
|
|
37
55
|
const ret = {
|
|
38
56
|
node: 'genericSQLExpr',
|
|
@@ -60,28 +78,24 @@ function sql(strings, ...subExprs) {
|
|
|
60
78
|
}
|
|
61
79
|
return ret;
|
|
62
80
|
}
|
|
63
|
-
exports.sql = sql;
|
|
64
81
|
function constant(type) {
|
|
65
82
|
return {
|
|
66
83
|
...type,
|
|
67
84
|
evalSpace: 'constant',
|
|
68
85
|
};
|
|
69
86
|
}
|
|
70
|
-
exports.constant = constant;
|
|
71
87
|
function output(type) {
|
|
72
88
|
return {
|
|
73
89
|
...type,
|
|
74
90
|
evalSpace: 'output',
|
|
75
91
|
};
|
|
76
92
|
}
|
|
77
|
-
exports.output = output;
|
|
78
93
|
function literal(type) {
|
|
79
94
|
return {
|
|
80
95
|
...type,
|
|
81
96
|
evalSpace: 'literal',
|
|
82
97
|
};
|
|
83
98
|
}
|
|
84
|
-
exports.literal = literal;
|
|
85
99
|
function variadicParam(name, ...allowedTypes) {
|
|
86
100
|
return {
|
|
87
101
|
name,
|
|
@@ -89,7 +103,6 @@ function variadicParam(name, ...allowedTypes) {
|
|
|
89
103
|
allowedTypes,
|
|
90
104
|
};
|
|
91
105
|
}
|
|
92
|
-
exports.variadicParam = variadicParam;
|
|
93
106
|
/**
|
|
94
107
|
* Prefer `makeParam` for future function definitions
|
|
95
108
|
*/
|
|
@@ -100,43 +113,33 @@ function param(name, ...allowedTypes) {
|
|
|
100
113
|
allowedTypes,
|
|
101
114
|
};
|
|
102
115
|
}
|
|
103
|
-
exports.param = param;
|
|
104
116
|
function makeParam(name, ...allowedTypes) {
|
|
105
117
|
return { param: param(name, ...allowedTypes), arg: arg(name) };
|
|
106
118
|
}
|
|
107
|
-
exports.makeParam = makeParam;
|
|
108
119
|
function maxScalar(type) {
|
|
109
120
|
return { ...type, expressionType: 'scalar', evalSpace: 'input' };
|
|
110
121
|
}
|
|
111
|
-
exports.maxScalar = maxScalar;
|
|
112
122
|
function maxAggregate(type) {
|
|
113
123
|
return { ...type, expressionType: 'aggregate', evalSpace: 'input' };
|
|
114
124
|
}
|
|
115
|
-
exports.maxAggregate = maxAggregate;
|
|
116
125
|
function anyExprType(type) {
|
|
117
126
|
return { ...type, expressionType: undefined, evalSpace: 'input' };
|
|
118
127
|
}
|
|
119
|
-
exports.anyExprType = anyExprType;
|
|
120
128
|
function maxUngroupedAggregate(type) {
|
|
121
129
|
return { ...type, expressionType: 'ungrouped_aggregate', evalSpace: 'input' };
|
|
122
130
|
}
|
|
123
|
-
exports.maxUngroupedAggregate = maxUngroupedAggregate;
|
|
124
131
|
function maxAnalytic(type) {
|
|
125
132
|
return { ...type, expressionType: 'aggregate_analytic', evalSpace: 'input' };
|
|
126
133
|
}
|
|
127
|
-
exports.maxAnalytic = maxAnalytic;
|
|
128
134
|
function minScalar(type) {
|
|
129
135
|
return { ...type, expressionType: 'scalar', evalSpace: 'input' };
|
|
130
136
|
}
|
|
131
|
-
exports.minScalar = minScalar;
|
|
132
137
|
function minAggregate(type) {
|
|
133
138
|
return { ...type, expressionType: 'aggregate', evalSpace: 'input' };
|
|
134
139
|
}
|
|
135
|
-
exports.minAggregate = minAggregate;
|
|
136
140
|
function minAnalytic(type) {
|
|
137
141
|
return { ...type, expressionType: 'scalar_analytic', evalSpace: 'input' };
|
|
138
142
|
}
|
|
139
|
-
exports.minAnalytic = minAnalytic;
|
|
140
143
|
function overload(returnType, params, e, options) {
|
|
141
144
|
return {
|
|
142
145
|
returnType,
|
|
@@ -150,7 +153,6 @@ function overload(returnType, params, e, options) {
|
|
|
150
153
|
supportsLimit: options === null || options === void 0 ? void 0 : options.supportsLimit,
|
|
151
154
|
};
|
|
152
155
|
}
|
|
153
|
-
exports.overload = overload;
|
|
154
156
|
function expandTypeDescElementBlueprint(blueprint, allowAny = true, allowGenerics = true) {
|
|
155
157
|
if (!allowAny && blueprint === 'any') {
|
|
156
158
|
throw new Error('Return type cannot include any');
|
|
@@ -436,7 +438,6 @@ function expandBlueprintMap(blueprints) {
|
|
|
436
438
|
}
|
|
437
439
|
return map;
|
|
438
440
|
}
|
|
439
|
-
exports.expandBlueprintMap = expandBlueprintMap;
|
|
440
441
|
function expandImplementationBlueprint(base, impl) {
|
|
441
442
|
return [expandBlueprint({ ...base, impl })];
|
|
442
443
|
}
|
|
@@ -470,7 +471,6 @@ function expandOverrideMapFromBase(base, overrides) {
|
|
|
470
471
|
}
|
|
471
472
|
return map;
|
|
472
473
|
}
|
|
473
|
-
exports.expandOverrideMapFromBase = expandOverrideMapFromBase;
|
|
474
474
|
/**
|
|
475
475
|
* Walks a type and returns all the generic references
|
|
476
476
|
* @param tdbp A type
|
|
@@ -548,5 +548,4 @@ function def(name, takes, returns, options = {}) {
|
|
|
548
548
|
};
|
|
549
549
|
return { [name]: newDef };
|
|
550
550
|
}
|
|
551
|
-
exports.def = def;
|
|
552
551
|
//# sourceMappingURL=util.js.map
|
|
@@ -48,6 +48,22 @@ const min_by = {
|
|
|
48
48
|
impl: { function: 'MIN_BY' },
|
|
49
49
|
isSymmetric: true,
|
|
50
50
|
};
|
|
51
|
+
const array_agg = {
|
|
52
|
+
takes: { x: T },
|
|
53
|
+
generic: { 'T': ['any'] },
|
|
54
|
+
returns: { measure: { array: T } },
|
|
55
|
+
supportsOrderBy: true,
|
|
56
|
+
impl: { sql: 'ARRAY_AGG(${x} ${order_by:})' },
|
|
57
|
+
isSymmetric: true,
|
|
58
|
+
};
|
|
59
|
+
const array_agg_distinct = {
|
|
60
|
+
takes: { x: T },
|
|
61
|
+
generic: { 'T': ['any'] },
|
|
62
|
+
returns: { measure: { array: T } },
|
|
63
|
+
supportsOrderBy: true,
|
|
64
|
+
impl: { sql: 'ARRAY_AGG(DISTINCT ${x} ${order_by:})' },
|
|
65
|
+
isSymmetric: true,
|
|
66
|
+
};
|
|
51
67
|
const string_agg = {
|
|
52
68
|
default_separator: {
|
|
53
69
|
takes: { 'value': { dimension: 'string' } },
|
|
@@ -295,6 +311,8 @@ exports.TRINO_DIALECT_FUNCTIONS = {
|
|
|
295
311
|
// window functions
|
|
296
312
|
percent_rank,
|
|
297
313
|
// array function
|
|
314
|
+
array_agg,
|
|
315
|
+
array_agg_distinct,
|
|
298
316
|
array_join,
|
|
299
317
|
sequence,
|
|
300
318
|
...(0, util_1.def)('array_distinct', { 'x': { array: T } }, { array: T }),
|
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export type { QueryOptionsReader, RunSQLOptions } from './run_sql_options';
|
|
|
10
10
|
export type { EventStream, ModelString, ModelURL, QueryString, QueryURL, URLReader, InvalidationKey, } from './runtime_types';
|
|
11
11
|
export type { Connection, ConnectionConfig, ConnectionFactory, ConnectionParameter, ConnectionParameterValue, ConnectionConfigSchema, FetchSchemaOptions, InfoConnection, LookupConnection, PersistSQLResults, PooledConnection, TestableConnection, StreamingConnection, } from './connection/types';
|
|
12
12
|
export { toAsyncGenerator } from './connection_utils';
|
|
13
|
-
export { modelDefToModelInfo } from './to_stable';
|
|
13
|
+
export { modelDefToModelInfo, sourceDefToSourceInfo } from './to_stable';
|
|
14
14
|
export * as API from './api';
|
|
15
15
|
export type { SQLSourceRequest } from './lang/translate-response';
|
|
16
16
|
export { sqlKey } from './model/sql_block';
|
package/dist/index.js
CHANGED
|
@@ -15,16 +15,26 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.EmptyURLReader = exports.SingleConnectionRuntime = exports.ConnectionRuntime = exports.AtomicFieldType = exports.Runtime = exports.Malloy = exports.Model = exports.MalloyTranslator = exports.malloyToQuery = exports.composeSQLExpr = exports.indent = exports.expressionIsUngroupedAggregate = exports.expressionIsScalar = exports.expressionIsCalculation = exports.expressionIsAnalytic = exports.expressionIsAggregate = exports.mkFieldDef = exports.mkArrayDef = exports.isBasicArray = exports.isRepeatedRecord = exports.isSamplingRows = exports.isSamplingPercent = exports.isSamplingEnable = exports.isJoinedSource = exports.isJoined = exports.isBasicAtomic = exports.Segment = exports.isSourceDef = exports.TinyParser = exports.Dialect = exports.spread = exports.literal = exports.variadicParam = exports.param = exports.makeParam = exports.sql = exports.maxScalar = exports.minAggregate = exports.anyExprType = exports.minScalar = exports.overload = exports.qtz = exports.arg = exports.registerDialect = exports.MySQLDialect = exports.SnowflakeDialect = exports.PostgresDialect = exports.TrinoDialect = exports.StandardSQLDialect = exports.DuckDBDialect = void 0;
|
|
27
|
-
exports.annotationToTaglines = exports.annotationToTag = exports.sqlKey = exports.API = exports.modelDefToModelInfo = exports.toAsyncGenerator = exports.CacheManager = exports.InMemoryModelCache = exports.Explore = exports.DataWriter = exports.Parse = exports.JSONWriter = exports.CSVWriter = exports.QueryMaterializer = exports.Result = exports.PreparedResult = exports.TimestampTimeframe = exports.DateTimeframe = exports.SourceRelationship = exports.JoinRelationship = exports.MalloyError = exports.FixedConnectionMap = exports.InMemoryURLReader = void 0;
|
|
37
|
+
exports.annotationToTaglines = exports.annotationToTag = exports.sqlKey = exports.API = exports.sourceDefToSourceInfo = exports.modelDefToModelInfo = exports.toAsyncGenerator = exports.CacheManager = exports.InMemoryModelCache = exports.Explore = exports.DataWriter = exports.Parse = exports.JSONWriter = exports.CSVWriter = exports.QueryMaterializer = exports.Result = exports.PreparedResult = exports.TimestampTimeframe = exports.DateTimeframe = exports.SourceRelationship = exports.JoinRelationship = exports.MalloyError = exports.FixedConnectionMap = exports.InMemoryURLReader = void 0;
|
|
28
38
|
/*
|
|
29
39
|
* Copyright 2023 Google LLC
|
|
30
40
|
*
|
|
@@ -124,6 +134,7 @@ var connection_utils_1 = require("./connection_utils");
|
|
|
124
134
|
Object.defineProperty(exports, "toAsyncGenerator", { enumerable: true, get: function () { return connection_utils_1.toAsyncGenerator; } });
|
|
125
135
|
var to_stable_1 = require("./to_stable");
|
|
126
136
|
Object.defineProperty(exports, "modelDefToModelInfo", { enumerable: true, get: function () { return to_stable_1.modelDefToModelInfo; } });
|
|
137
|
+
Object.defineProperty(exports, "sourceDefToSourceInfo", { enumerable: true, get: function () { return to_stable_1.sourceDefToSourceInfo; } });
|
|
127
138
|
exports.API = __importStar(require("./api"));
|
|
128
139
|
var sql_block_1 = require("./model/sql_block");
|
|
129
140
|
Object.defineProperty(exports, "sqlKey", { enumerable: true, get: function () { return sql_block_1.sqlKey; } });
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.errorFor =
|
|
25
|
+
exports.errorFor = errorFor;
|
|
26
26
|
/**
|
|
27
27
|
* When a translation hits an error, log and return one of these as a value.
|
|
28
28
|
* This will allow the rest of the translation walk to complete. The
|
|
@@ -40,5 +40,4 @@ function errorFor(reason) {
|
|
|
40
40
|
fieldUsage: [],
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
-
exports.errorFor = errorFor;
|
|
44
43
|
//# sourceMappingURL=ast-utils.js.map
|
|
@@ -37,13 +37,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
37
37
|
}) : function(o, v) {
|
|
38
38
|
o["default"] = v;
|
|
39
39
|
});
|
|
40
|
-
var __importStar = (this && this.__importStar) || function (
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
};
|
|
40
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
41
|
+
var ownKeys = function(o) {
|
|
42
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
43
|
+
var ar = [];
|
|
44
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
45
|
+
return ar;
|
|
46
|
+
};
|
|
47
|
+
return ownKeys(o);
|
|
48
|
+
};
|
|
49
|
+
return function (mod) {
|
|
50
|
+
if (mod && mod.__esModule) return mod;
|
|
51
|
+
var result = {};
|
|
52
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
53
|
+
__setModuleDefault(result, mod);
|
|
54
|
+
return result;
|
|
55
|
+
};
|
|
56
|
+
})();
|
|
47
57
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
58
|
exports.BinaryBoolean = void 0;
|
|
49
59
|
const ast_utils_1 = require("../ast-utils");
|
|
@@ -37,13 +37,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
37
37
|
}) : function(o, v) {
|
|
38
38
|
o["default"] = v;
|
|
39
39
|
});
|
|
40
|
-
var __importStar = (this && this.__importStar) || function (
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
};
|
|
40
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
41
|
+
var ownKeys = function(o) {
|
|
42
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
43
|
+
var ar = [];
|
|
44
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
45
|
+
return ar;
|
|
46
|
+
};
|
|
47
|
+
return ownKeys(o);
|
|
48
|
+
};
|
|
49
|
+
return function (mod) {
|
|
50
|
+
if (mod && mod.__esModule) return mod;
|
|
51
|
+
var result = {};
|
|
52
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
53
|
+
__setModuleDefault(result, mod);
|
|
54
|
+
return result;
|
|
55
|
+
};
|
|
56
|
+
})();
|
|
47
57
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
58
|
exports.BinaryNumeric = void 0;
|
|
49
59
|
const TDU = __importStar(require("../typedesc-utils"));
|
|
@@ -37,13 +37,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
37
37
|
}) : function(o, v) {
|
|
38
38
|
o["default"] = v;
|
|
39
39
|
});
|
|
40
|
-
var __importStar = (this && this.__importStar) || function (
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
};
|
|
40
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
41
|
+
var ownKeys = function(o) {
|
|
42
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
43
|
+
var ar = [];
|
|
44
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
45
|
+
return ar;
|
|
46
|
+
};
|
|
47
|
+
return ownKeys(o);
|
|
48
|
+
};
|
|
49
|
+
return function (mod) {
|
|
50
|
+
if (mod && mod.__esModule) return mod;
|
|
51
|
+
var result = {};
|
|
52
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
53
|
+
__setModuleDefault(result, mod);
|
|
54
|
+
return result;
|
|
55
|
+
};
|
|
56
|
+
})();
|
|
47
57
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
58
|
exports.Boolean = void 0;
|
|
49
59
|
const expression_def_1 = require("../types/expression-def");
|
|
@@ -21,13 +21,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
21
21
|
}) : function(o, v) {
|
|
22
22
|
o["default"] = v;
|
|
23
23
|
});
|
|
24
|
-
var __importStar = (this && this.__importStar) || function (
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
};
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
31
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
42
|
exports.CaseWhen = exports.Case = void 0;
|
|
33
43
|
const expr_value_1 = require("../types/expr-value");
|
|
@@ -37,13 +37,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
37
37
|
}) : function(o, v) {
|
|
38
38
|
o["default"] = v;
|
|
39
39
|
});
|
|
40
|
-
var __importStar = (this && this.__importStar) || function (
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
};
|
|
40
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
41
|
+
var ownKeys = function(o) {
|
|
42
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
43
|
+
var ar = [];
|
|
44
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
45
|
+
return ar;
|
|
46
|
+
};
|
|
47
|
+
return ownKeys(o);
|
|
48
|
+
};
|
|
49
|
+
return function (mod) {
|
|
50
|
+
if (mod && mod.__esModule) return mod;
|
|
51
|
+
var result = {};
|
|
52
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
53
|
+
__setModuleDefault(result, mod);
|
|
54
|
+
return result;
|
|
55
|
+
};
|
|
56
|
+
})();
|
|
47
57
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
58
|
exports.ExprAggregateFunction = void 0;
|
|
49
59
|
const malloy_types_1 = require("../../../model/malloy_types");
|
|
@@ -21,13 +21,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
21
21
|
}) : function(o, v) {
|
|
22
22
|
o["default"] = v;
|
|
23
23
|
});
|
|
24
|
-
var __importStar = (this && this.__importStar) || function (
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
};
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
31
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
42
|
exports.ArrayLiteral = void 0;
|
|
33
43
|
const expr_value_1 = require("../types/expr-value");
|
|
@@ -37,13 +37,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
37
37
|
}) : function(o, v) {
|
|
38
38
|
o["default"] = v;
|
|
39
39
|
});
|
|
40
|
-
var __importStar = (this && this.__importStar) || function (
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
};
|
|
40
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
41
|
+
var ownKeys = function(o) {
|
|
42
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
43
|
+
var ar = [];
|
|
44
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
45
|
+
return ar;
|
|
46
|
+
};
|
|
47
|
+
return ownKeys(o);
|
|
48
|
+
};
|
|
49
|
+
return function (mod) {
|
|
50
|
+
if (mod && mod.__esModule) return mod;
|
|
51
|
+
var result = {};
|
|
52
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
53
|
+
__setModuleDefault(result, mod);
|
|
54
|
+
return result;
|
|
55
|
+
};
|
|
56
|
+
})();
|
|
47
57
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
58
|
exports.ExprCoalesce = void 0;
|
|
49
59
|
const model_1 = require("../../../model");
|
|
@@ -37,13 +37,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
37
37
|
}) : function(o, v) {
|
|
38
38
|
o["default"] = v;
|
|
39
39
|
});
|
|
40
|
-
var __importStar = (this && this.__importStar) || function (
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
};
|
|
40
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
41
|
+
var ownKeys = function(o) {
|
|
42
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
43
|
+
var ar = [];
|
|
44
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
45
|
+
return ar;
|
|
46
|
+
};
|
|
47
|
+
return ownKeys(o);
|
|
48
|
+
};
|
|
49
|
+
return function (mod) {
|
|
50
|
+
if (mod && mod.__esModule) return mod;
|
|
51
|
+
var result = {};
|
|
52
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
53
|
+
__setModuleDefault(result, mod);
|
|
54
|
+
return result;
|
|
55
|
+
};
|
|
56
|
+
})();
|
|
47
57
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
58
|
exports.ExprLegacyIn = exports.ExprEquality = exports.ExprCompare = void 0;
|
|
49
59
|
const TDU = __importStar(require("../typedesc-utils"));
|
|
@@ -37,13 +37,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
37
37
|
}) : function(o, v) {
|
|
38
38
|
o["default"] = v;
|
|
39
39
|
});
|
|
40
|
-
var __importStar = (this && this.__importStar) || function (
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
};
|
|
40
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
41
|
+
var ownKeys = function(o) {
|
|
42
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
43
|
+
var ar = [];
|
|
44
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
45
|
+
return ar;
|
|
46
|
+
};
|
|
47
|
+
return ownKeys(o);
|
|
48
|
+
};
|
|
49
|
+
return function (mod) {
|
|
50
|
+
if (mod && mod.__esModule) return mod;
|
|
51
|
+
var result = {};
|
|
52
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
53
|
+
__setModuleDefault(result, mod);
|
|
54
|
+
return result;
|
|
55
|
+
};
|
|
56
|
+
})();
|
|
47
57
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
58
|
exports.ExprCountDistinct = void 0;
|
|
49
59
|
const TDU = __importStar(require("../typedesc-utils"));
|
|
@@ -37,13 +37,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
37
37
|
}) : function(o, v) {
|
|
38
38
|
o["default"] = v;
|
|
39
39
|
});
|
|
40
|
-
var __importStar = (this && this.__importStar) || function (
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
};
|
|
40
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
41
|
+
var ownKeys = function(o) {
|
|
42
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
43
|
+
var ar = [];
|
|
44
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
45
|
+
return ar;
|
|
46
|
+
};
|
|
47
|
+
return ownKeys(o);
|
|
48
|
+
};
|
|
49
|
+
return function (mod) {
|
|
50
|
+
if (mod && mod.__esModule) return mod;
|
|
51
|
+
var result = {};
|
|
52
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
53
|
+
__setModuleDefault(result, mod);
|
|
54
|
+
return result;
|
|
55
|
+
};
|
|
56
|
+
})();
|
|
47
57
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
58
|
exports.ExprFunc = void 0;
|
|
49
59
|
const malloy_types_1 = require("../../../model/malloy_types");
|
|
@@ -287,29 +297,18 @@ class ExprFunc extends expression_def_1.ExpressionDef {
|
|
|
287
297
|
else {
|
|
288
298
|
const literal = str.literal;
|
|
289
299
|
const parts = parseSQLInterpolation(literal);
|
|
290
|
-
const unsupportedInterpolations = parts
|
|
291
|
-
.filter(part => part.type === 'interpolation' && part.name.includes('.'))
|
|
292
|
-
.map(unsupportedPart => unsupportedPart.type === 'interpolation'
|
|
293
|
-
? `\${${unsupportedPart.name}}`
|
|
294
|
-
: `\${${unsupportedPart.value}}`);
|
|
295
|
-
if (unsupportedInterpolations.length > 0) {
|
|
296
|
-
const unsupportedInterpolationMsg = unsupportedInterpolations.length === 1
|
|
297
|
-
? `'.' paths are not yet supported in sql interpolations, found ${unsupportedInterpolations.at(0)}`
|
|
298
|
-
: `'.' paths are not yet supported in sql interpolations, found (${unsupportedInterpolations.join(', ')})`;
|
|
299
|
-
return this.loggedErrorExpr('unsupported-sql-function-interpolation', unsupportedInterpolationMsg);
|
|
300
|
-
}
|
|
301
300
|
const expr = [];
|
|
302
301
|
for (const part of parts) {
|
|
303
302
|
if (part.type === 'string') {
|
|
304
303
|
expr.push(part.value);
|
|
305
304
|
}
|
|
306
|
-
else if (part.
|
|
305
|
+
else if (part.path.length === 1 && part.path[0] === 'TABLE') {
|
|
307
306
|
expr.push({ node: 'source-reference' });
|
|
308
307
|
}
|
|
309
308
|
else {
|
|
310
|
-
const
|
|
311
|
-
this.has({
|
|
312
|
-
const result = fs.lookup(
|
|
309
|
+
const names = part.path.map(p => new field_space_1.FieldName(p));
|
|
310
|
+
this.has({ names });
|
|
311
|
+
const result = fs.lookup(names);
|
|
313
312
|
if (result.found === undefined) {
|
|
314
313
|
return this.loggedErrorExpr('sql-function-interpolation-not-found', `Invalid interpolation: ${result.error.message}`);
|
|
315
314
|
}
|
|
@@ -317,12 +316,13 @@ class ExprFunc extends expression_def_1.ExpressionDef {
|
|
|
317
316
|
return this.loggedErrorExpr('filter-expression-error', 'Filter expressions cannot be used in sql_ functions');
|
|
318
317
|
}
|
|
319
318
|
if (result.found.refType === 'parameter') {
|
|
320
|
-
expr.push({ node: 'parameter', path:
|
|
319
|
+
expr.push({ node: 'parameter', path: part.path });
|
|
321
320
|
}
|
|
322
321
|
else {
|
|
323
322
|
expr.push({
|
|
324
323
|
node: 'field',
|
|
325
|
-
|
|
324
|
+
// TODO when we have namespaces, this will need to be replaced with the resolved path
|
|
325
|
+
path: part.path,
|
|
326
326
|
at: this.args[0].location,
|
|
327
327
|
});
|
|
328
328
|
}
|
|
@@ -473,7 +473,9 @@ function parseSQLInterpolation(template) {
|
|
|
473
473
|
}
|
|
474
474
|
parts.push({
|
|
475
475
|
type: 'interpolation',
|
|
476
|
-
|
|
476
|
+
path: remaining
|
|
477
|
+
.slice(nextInterp + 2, interpEnd + nextInterp)
|
|
478
|
+
.split('.'),
|
|
477
479
|
});
|
|
478
480
|
remaining = remaining.slice(interpEnd + nextInterp + 1);
|
|
479
481
|
}
|