@malloydata/malloy 0.0.433 → 0.0.435
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/api/foundation/compile.d.ts +2 -2
- package/dist/api/foundation/compile.js +8 -9
- package/dist/api/foundation/config.js +6 -15
- package/dist/api/foundation/runtime.d.ts +2 -8
- package/dist/api/foundation/runtime.js +11 -39
- package/dist/api/foundation/types.d.ts +1 -1
- package/dist/connection/validate_table_path.d.ts +1 -2
- package/dist/connection/validate_table_path.js +1 -2
- package/dist/dialect/databricks/databricks.js +6 -6
- package/dist/dialect/dialect.d.ts +35 -3
- package/dist/dialect/dialect.js +67 -5
- package/dist/dialect/dialect_map.js +2 -0
- package/dist/dialect/duckdb/duckdb.js +7 -21
- package/dist/dialect/index.d.ts +2 -1
- package/dist/dialect/index.js +3 -1
- package/dist/dialect/mysql/mysql.js +8 -8
- package/dist/dialect/pg_impl.js +12 -12
- package/dist/dialect/postgres/postgres.js +3 -3
- package/dist/dialect/snowflake/snowflake.js +12 -12
- package/dist/dialect/sqlserver/dialect_functions.d.ts +2 -0
- package/dist/dialect/sqlserver/dialect_functions.js +42 -0
- package/dist/dialect/sqlserver/function_overrides.d.ts +2 -0
- package/dist/dialect/sqlserver/function_overrides.js +55 -0
- package/dist/dialect/sqlserver/index.d.ts +1 -0
- package/dist/dialect/sqlserver/index.js +22 -0
- package/dist/dialect/sqlserver/sqlserver.d.ts +102 -0
- package/dist/dialect/sqlserver/sqlserver.js +538 -0
- package/dist/dialect/sqlserver/windows_zones.d.ts +1 -0
- package/dist/dialect/sqlserver/windows_zones.js +613 -0
- package/dist/dialect/standardsql/standardsql.d.ts +1 -1
- package/dist/dialect/standardsql/standardsql.js +16 -13
- package/dist/dialect/trino/trino.d.ts +3 -3
- package/dist/dialect/trino/trino.js +32 -28
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -3
- package/dist/lang/ast/source-elements/named-source.js +0 -2
- package/dist/lang/ast/source-elements/refined-source.js +1 -1
- package/dist/lang/ast/source-elements/sql-source.js +2 -4
- package/dist/lang/ast/source-elements/table-source.js +1 -2
- package/dist/lang/ast/source-properties/timezone-statement.d.ts +4 -3
- package/dist/lang/ast/source-properties/timezone-statement.js +14 -12
- package/dist/lang/ast/statements/import-statement.js +4 -0
- package/dist/lang/ast/types/malloy-element.d.ts +0 -7
- package/dist/lang/ast/types/malloy-element.js +0 -18
- package/dist/lang/composite-source-utils.js +10 -3
- package/dist/lang/malloy-to-ast.js +2 -8
- package/dist/lang/parse-malloy.d.ts +20 -4
- package/dist/lang/parse-malloy.js +50 -15
- package/dist/lang/parse-tree-walkers/find-external-references.d.ts +3 -3
- package/dist/lang/parse-tree-walkers/find-external-references.js +17 -16
- package/dist/lang/test/test-translator.d.ts +12 -2
- package/dist/lang/test/test-translator.js +16 -2
- package/dist/model/expression_compiler.js +1 -1
- package/dist/model/join_instance.d.ts +1 -0
- package/dist/model/join_instance.js +9 -1
- package/dist/model/query_query.d.ts +28 -1
- package/dist/model/query_query.js +299 -156
- package/dist/model/source_def_utils.d.ts +7 -1
- package/dist/model/source_def_utils.js +20 -0
- package/dist/model/sql_block.d.ts +2 -2
- package/dist/model/sql_block.js +11 -47
- package/dist/model/sql_compiled.d.ts +3 -1
- package/dist/model/sql_compiled.js +8 -6
- package/dist/model/stage_writer.js +3 -3
- package/dist/model/utils.d.ts +2 -2
- package/dist/model/utils.js +2 -3
- package/dist/test/index.js +16 -8
- package/dist/test/matchers.d.ts +1 -1
- package/dist/test/matchers.js +1 -1
- package/dist/test/test-models.js +6 -13
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/femto-config.motly +15 -1
- package/package.json +7 -5
|
@@ -7,7 +7,13 @@
|
|
|
7
7
|
* fields they need, never using spread, so identity is not propagated onto a
|
|
8
8
|
* freshly built source.
|
|
9
9
|
*/
|
|
10
|
-
import type { BuildID, FieldDef, GivenID, ModelDef, PersistableSourceDef, Query, QuerySourceDef, SourceDef, SourceID, SourceRegistryEntry, SourceRegistryValue, SQLPhraseSegment, SQLSourceDef, TableSourceDef } from './malloy_types';
|
|
10
|
+
import type { BuildID, FieldDef, GivenID, ModelDef, NamedModelObject, PersistableSourceDef, Query, QuerySourceDef, SourceDef, SourceID, SourceRegistryEntry, SourceRegistryValue, SQLPhraseSegment, SQLSourceDef, TableSourceDef } from './malloy_types';
|
|
11
|
+
/**
|
|
12
|
+
* The dialect an entry commits whoever imports it to, if any. A query begins
|
|
13
|
+
* at a source, which is either inline in the query or named in the model the
|
|
14
|
+
* query came from.
|
|
15
|
+
*/
|
|
16
|
+
export declare function dialectOfEntry(entry: NamedModelObject, from: ModelDef): string | undefined;
|
|
11
17
|
export declare function mkSourceID(name: string, url: string | undefined): SourceID;
|
|
12
18
|
export declare function mkGivenID(name: string, url: string | undefined): GivenID;
|
|
13
19
|
/**
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: MIT
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.dialectOfEntry = dialectOfEntry;
|
|
7
8
|
exports.mkSourceID = mkSourceID;
|
|
8
9
|
exports.mkGivenID = mkGivenID;
|
|
9
10
|
exports.mkBuildID = mkBuildID;
|
|
@@ -17,6 +18,25 @@ exports.registerSource = registerSource;
|
|
|
17
18
|
exports.hasSourceRegistryEntry = hasSourceRegistryEntry;
|
|
18
19
|
const utils_1 = require("./utils");
|
|
19
20
|
const malloy_types_1 = require("./malloy_types");
|
|
21
|
+
/**
|
|
22
|
+
* The dialect an entry commits whoever imports it to, if any. A query begins
|
|
23
|
+
* at a source, which is either inline in the query or named in the model the
|
|
24
|
+
* query came from.
|
|
25
|
+
*/
|
|
26
|
+
function dialectOfEntry(entry, from) {
|
|
27
|
+
if ((0, malloy_types_1.isSourceDef)(entry)) {
|
|
28
|
+
return entry.dialect;
|
|
29
|
+
}
|
|
30
|
+
if (entry.type === 'query') {
|
|
31
|
+
const head = entry.structRef;
|
|
32
|
+
if (typeof head === 'string') {
|
|
33
|
+
const named = (0, malloy_types_1.safeRecordGet)(from.contents, head);
|
|
34
|
+
return named && (0, malloy_types_1.isSourceDef)(named) ? named.dialect : undefined;
|
|
35
|
+
}
|
|
36
|
+
return head.dialect;
|
|
37
|
+
}
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
20
40
|
function mkSourceID(name, url) {
|
|
21
41
|
return `${name}@${url !== null && url !== void 0 ? url : 'unknown'}`;
|
|
22
42
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { SQLSourceRequest } from '../lang/translate-response';
|
|
2
|
-
import type { SQLPhraseSegment, ModelDef } from './malloy_types';
|
|
2
|
+
import type { SQLPhraseSegment, ModelDef, VirtualMap } from './malloy_types';
|
|
3
3
|
/**
|
|
4
4
|
* The translator needs to know the output schema of an SQLSourceDef
|
|
5
5
|
* this will prepare an SQL string suitable to answer that question.
|
|
6
6
|
*/
|
|
7
|
-
export declare function getSourceRequest(select: SQLPhraseSegment[], connection: string, partialModel: ModelDef | undefined): SQLSourceRequest;
|
|
7
|
+
export declare function getSourceRequest(select: SQLPhraseSegment[], connection: string, partialModel: ModelDef | undefined, virtualMap?: VirtualMap): SQLSourceRequest;
|
|
8
8
|
export declare function sqlKey(connectionName: string, sql: string): string;
|
package/dist/model/sql_block.js
CHANGED
|
@@ -7,62 +7,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
exports.getSourceRequest = getSourceRequest;
|
|
8
8
|
exports.sqlKey = sqlKey;
|
|
9
9
|
const query_model_1 = require("./query_model");
|
|
10
|
-
const
|
|
10
|
+
const sql_compiled_1 = require("./sql_compiled");
|
|
11
11
|
const utils_1 = require("./utils");
|
|
12
12
|
/**
|
|
13
13
|
* The translator needs to know the output schema of an SQLSourceDef
|
|
14
14
|
* this will prepare an SQL string suitable to answer that question.
|
|
15
15
|
*/
|
|
16
|
-
function getSourceRequest(select, connection, partialModel) {
|
|
17
|
-
let queryModel
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
selectStr += segment.sql;
|
|
23
|
-
parenAlready = segment.sql.match(/\(\s*$/) !== null;
|
|
24
|
-
}
|
|
25
|
-
else if ((0, malloy_types_1.isSegmentSource)(segment)) {
|
|
26
|
-
// PersistableSourceDef (sql_select or query_source)
|
|
27
|
-
let compiledSql;
|
|
28
|
-
if (segment.type === 'sql_select') {
|
|
29
|
-
compiledSql = segment.selectStr;
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
// query_source - compile the inner query
|
|
33
|
-
if (!queryModel) {
|
|
34
|
-
if (!partialModel) {
|
|
35
|
-
throw new Error('Internal error: Partial model missing when compiling SQL block');
|
|
36
|
-
}
|
|
37
|
-
queryModel = (0, query_model_1.makeQueryModel)(partialModel);
|
|
38
|
-
}
|
|
39
|
-
compiledSql = queryModel.compileQuery(segment.query, {
|
|
40
|
-
defaultRowLimit: undefined,
|
|
41
|
-
isPartialQuery: true,
|
|
42
|
-
}, false).sql;
|
|
16
|
+
function getSourceRequest(select, connection, partialModel, virtualMap) {
|
|
17
|
+
let queryModel;
|
|
18
|
+
const compileQuery = (query, options) => {
|
|
19
|
+
if (!queryModel) {
|
|
20
|
+
if (!partialModel) {
|
|
21
|
+
throw new Error('Internal error: Partial model missing when compiling SQL block');
|
|
43
22
|
}
|
|
44
|
-
|
|
45
|
-
parenAlready = false;
|
|
23
|
+
queryModel = (0, query_model_1.makeQueryModel)(partialModel);
|
|
46
24
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
if (!queryModel) {
|
|
50
|
-
if (!partialModel) {
|
|
51
|
-
throw new Error('Internal error: Partial model missing when compiling SQL block');
|
|
52
|
-
}
|
|
53
|
-
queryModel = (0, query_model_1.makeQueryModel)(partialModel);
|
|
54
|
-
}
|
|
55
|
-
const compiledSql = queryModel.compileQuery(segment, {
|
|
56
|
-
defaultRowLimit: undefined,
|
|
57
|
-
isPartialQuery: true,
|
|
58
|
-
}, false).sql;
|
|
59
|
-
selectStr += parenAlready ? compiledSql : `(${compiledSql})`;
|
|
60
|
-
parenAlready = false;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
25
|
+
return queryModel.compileQuery(query, { ...options, defaultRowLimit: undefined, isPartialQuery: true }, false).sql;
|
|
26
|
+
};
|
|
63
27
|
return {
|
|
64
28
|
connection,
|
|
65
|
-
selectStr,
|
|
29
|
+
selectStr: (0, sql_compiled_1.expandSQLSegments)(select, { virtualMap }, compileQuery),
|
|
66
30
|
};
|
|
67
31
|
}
|
|
68
32
|
function sqlKey(connectionName, sql) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PrepareResultOptions, SQLSourceDef, PersistableSourceDef, Query, VirtualMap } from './malloy_types';
|
|
1
|
+
import type { PrepareResultOptions, SQLSourceDef, SQLPhraseSegment, PersistableSourceDef, Query, VirtualMap } from './malloy_types';
|
|
2
2
|
/**
|
|
3
3
|
* Callback type for compiling a Query to SQL.
|
|
4
4
|
* opts is optional - omit for "full SQL" (BuildID computation),
|
|
@@ -16,6 +16,8 @@ export type CompileQueryCallback = (query: Query, opts?: PrepareResultOptions) =
|
|
|
16
16
|
* @param compileQuery Callback to compile a Query to SQL
|
|
17
17
|
*/
|
|
18
18
|
export declare function getCompiledSQL(src: SQLSourceDef, opts: PrepareResultOptions, compileQuery: CompileQueryCallback): string;
|
|
19
|
+
/** Expand SQL text and interpolations for schema discovery or execution. */
|
|
20
|
+
export declare function expandSQLSegments(segments: SQLPhraseSegment[], opts: PrepareResultOptions, compileQuery: CompileQueryCallback): string;
|
|
19
21
|
/**
|
|
20
22
|
* The options a BuildID's SQL is compiled under — everything the builder and
|
|
21
23
|
* the compiler must both know, and nothing else.
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.getCompiledSQL = getCompiledSQL;
|
|
8
|
+
exports.expandSQLSegments = expandSQLSegments;
|
|
8
9
|
exports.buildIdOptions = buildIdOptions;
|
|
9
10
|
exports.persistedTableFor = persistedTableFor;
|
|
10
11
|
exports.getSourceSQL = getSourceSQL;
|
|
@@ -26,12 +27,13 @@ function getCompiledSQL(src, opts, compileQuery) {
|
|
|
26
27
|
if (!src.selectSegments || src.selectSegments.length === 0) {
|
|
27
28
|
return src.selectStr;
|
|
28
29
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
return expandSQLSegments(src.selectSegments, opts, compileQuery);
|
|
31
|
+
}
|
|
32
|
+
/** Expand SQL text and interpolations for schema discovery or execution. */
|
|
33
|
+
function expandSQLSegments(segments, opts, compileQuery) {
|
|
34
|
+
return segments
|
|
35
|
+
.map(segment => expandSegment(segment, opts, compileQuery))
|
|
36
|
+
.join('');
|
|
35
37
|
}
|
|
36
38
|
/**
|
|
37
39
|
* Expand a single SQLPhraseSegment to SQL.
|
|
@@ -51,7 +51,7 @@ class StageWriter {
|
|
|
51
51
|
if (lastStageName === undefined) {
|
|
52
52
|
throw new Error('Internal Error: no stage to combine');
|
|
53
53
|
}
|
|
54
|
-
sql += dialect.sqlCreateFunctionCombineLastStage(lastStageName, (0, utils_1.getDialectFieldList)(structDef), (_a = structDef.resultMetadata) === null || _a === void 0 ? void 0 : _a.orderBy);
|
|
54
|
+
sql += dialect.sqlCreateFunctionCombineLastStage(lastStageName, (0, utils_1.getDialectFieldList)(structDef, dialect), (_a = structDef.resultMetadata) === null || _a === void 0 ? void 0 : _a.orderBy);
|
|
55
55
|
const id = `${dialect.udfPrefix}${this.root().udfs.length}`;
|
|
56
56
|
sql = dialect.sqlCreateFunction(id, sql);
|
|
57
57
|
this.root().udfs.push(sql);
|
|
@@ -98,11 +98,11 @@ class StageWriter {
|
|
|
98
98
|
generateCoorelatedSubQuery(dialect, structDef) {
|
|
99
99
|
var _a, _b;
|
|
100
100
|
if (!this.useCTE) {
|
|
101
|
-
return dialect.sqlCreateFunctionCombineLastStage(`(${this.withs[0]})`, (0, utils_1.getDialectFieldList)(structDef), (_a = structDef.resultMetadata) === null || _a === void 0 ? void 0 : _a.orderBy);
|
|
101
|
+
return dialect.sqlCreateFunctionCombineLastStage(`(${this.withs[0]})`, (0, utils_1.getDialectFieldList)(structDef, dialect), (_a = structDef.resultMetadata) === null || _a === void 0 ? void 0 : _a.orderBy);
|
|
102
102
|
}
|
|
103
103
|
else {
|
|
104
104
|
return (this.combineStages(true).sql +
|
|
105
|
-
dialect.sqlCreateFunctionCombineLastStage(this.getName(this.withs.length - 1), (0, utils_1.getDialectFieldList)(structDef), (_b = structDef.resultMetadata) === null || _b === void 0 ? void 0 : _b.orderBy));
|
|
105
|
+
dialect.sqlCreateFunctionCombineLastStage(this.getName(this.withs.length - 1), (0, utils_1.getDialectFieldList)(structDef, dialect), (_b = structDef.resultMetadata) === null || _b === void 0 ? void 0 : _b.orderBy));
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
}
|
package/dist/model/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AtomicTypeDef, Expr, FieldDef, GenericSQLExpr, GivenTypeDef, ModelDef, ModelID, StructDef } from './malloy_types';
|
|
2
|
-
import type { DialectFieldList } from '../dialect';
|
|
2
|
+
import type { Dialect, DialectFieldList } from '../dialect';
|
|
3
3
|
/**
|
|
4
4
|
* Format a typeDef as user-readable Malloy type syntax. Used in error
|
|
5
5
|
* messages where we want to echo a compound type back to the user in the
|
|
@@ -58,7 +58,7 @@ export type SQLExprElement = string | Expr;
|
|
|
58
58
|
* expression node.
|
|
59
59
|
*/
|
|
60
60
|
export declare function composeSQLExpr(from: SQLExprElement[]): GenericSQLExpr;
|
|
61
|
-
export declare function getDialectFieldList(structDef: StructDef): DialectFieldList;
|
|
61
|
+
export declare function getDialectFieldList(structDef: StructDef, dialect: Dialect): DialectFieldList;
|
|
62
62
|
/**
|
|
63
63
|
* A little extra paranoia to save us from fields which contain the special
|
|
64
64
|
* characters used to build the grouping key.
|
package/dist/model/utils.js
CHANGED
|
@@ -251,14 +251,13 @@ function composeSQLExpr(from) {
|
|
|
251
251
|
}
|
|
252
252
|
return ret;
|
|
253
253
|
}
|
|
254
|
-
function getDialectFieldList(structDef) {
|
|
254
|
+
function getDialectFieldList(structDef, dialect) {
|
|
255
255
|
const dialectFieldList = [];
|
|
256
256
|
for (const f of structDef.fields.filter(malloy_types_1.fieldIsIntrinsic)) {
|
|
257
257
|
dialectFieldList.push({
|
|
258
258
|
typeDef: f,
|
|
259
|
-
sqlExpression: (0, malloy_types_1.activeName)(f),
|
|
259
|
+
sqlExpression: dialect.sqlQuoteIdentifier((0, malloy_types_1.activeName)(f)),
|
|
260
260
|
rawName: (0, malloy_types_1.activeName)(f),
|
|
261
|
-
sqlOutputName: (0, malloy_types_1.activeName)(f),
|
|
262
261
|
});
|
|
263
262
|
}
|
|
264
263
|
return dialectFieldList;
|
package/dist/test/index.js
CHANGED
|
@@ -113,14 +113,20 @@ function databasesFromEnvironmentOr(defaultDatabases) {
|
|
|
113
113
|
: defaultDatabases;
|
|
114
114
|
}
|
|
115
115
|
/**
|
|
116
|
-
* A replacement for [describe()] that mimics [describe.skip()]
|
|
116
|
+
* A replacement for [describe()] that mimics [describe.skip()].
|
|
117
|
+
*
|
|
118
|
+
* Built on demand, not at module scope: this module is also imported outside
|
|
119
|
+
* jest (scripts that construct a test connection), where the jest globals do
|
|
120
|
+
* not exist.
|
|
117
121
|
*/
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
})
|
|
122
|
+
function makeDescribeSkip() {
|
|
123
|
+
return Object.assign((name, fn) => describe.skip(name, fn), {
|
|
124
|
+
skip: describe.skip,
|
|
125
|
+
// eslint-disable-next-line no-restricted-properties
|
|
126
|
+
only: describe.only,
|
|
127
|
+
each: (() => () => it.skip('skipped', () => { })),
|
|
128
|
+
});
|
|
129
|
+
}
|
|
124
130
|
/**
|
|
125
131
|
* Confirms that one or more of the databases being tested overlaps with
|
|
126
132
|
* the databases a test suite can accept. If there is overlap, return a tuple
|
|
@@ -130,7 +136,9 @@ const describeSkip = Object.assign((name, fn) => describe.skip(name, fn), {
|
|
|
130
136
|
function describeIfDatabaseAvailable(acceptableDatabases) {
|
|
131
137
|
const currentDatabases = databasesFromEnvironmentOr(acceptableDatabases);
|
|
132
138
|
const overlap = acceptableDatabases.filter(d => currentDatabases.includes(d));
|
|
133
|
-
return overlap.length > 0
|
|
139
|
+
return overlap.length > 0
|
|
140
|
+
? [describe, overlap]
|
|
141
|
+
: [makeDescribeSkip(), overlap];
|
|
134
142
|
}
|
|
135
143
|
function brokenIn(dialectName, connectionName) {
|
|
136
144
|
return dialectName === connectionName;
|
package/dist/test/matchers.d.ts
CHANGED
package/dist/test/matchers.js
CHANGED
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
/**
|
|
8
8
|
* Import this module to register Jest matchers (toMatchResult, toEqualResult).
|
|
9
9
|
*
|
|
10
|
-
* Usage in jest.config.
|
|
10
|
+
* Usage in jest.config.ts:
|
|
11
11
|
* setupFilesAfterEnv: ['@malloydata/malloy/test/matchers']
|
|
12
12
|
*
|
|
13
13
|
* Or import directly in a test file:
|
package/dist/test/test-models.js
CHANGED
|
@@ -229,19 +229,12 @@ function generateSQL(dialect, rows) {
|
|
|
229
229
|
.join(', ');
|
|
230
230
|
const innerQuery = selects.join('\nUNION ALL ');
|
|
231
231
|
// Generate ORDER BY based on dialect preference
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
}
|
|
239
|
-
else {
|
|
240
|
-
orderByClause = `ORDER BY ${rowIdColumn}`;
|
|
241
|
-
}
|
|
242
|
-
// Presto/Trino ignores ORDER BY on a subquery without LIMIT
|
|
243
|
-
orderByClause += ` LIMIT ${rows.length}`;
|
|
244
|
-
const sql = `SELECT ${quotedColumns}\nFROM (\n SELECT *\n FROM (\n${innerQuery}\n ) AS t_sorted\n ${orderByClause}\n) AS t_result\n`;
|
|
232
|
+
const orderTerm = dialect.orderByClause === 'ordinal'
|
|
233
|
+
? `${columnList.length + 1}`
|
|
234
|
+
: rowIdColumn;
|
|
235
|
+
// Presto/Trino ignores ORDER BY on a subquery without a row limit
|
|
236
|
+
const orderByClause = dialect.sqlOrderByLimit([orderTerm], rows.length);
|
|
237
|
+
const sql = `SELECT ${quotedColumns}\nFROM (\n SELECT *\n FROM (\n${innerQuery}\n ) AS t_sorted\n ${orderByClause}) AS t_result\n`;
|
|
245
238
|
return sql;
|
|
246
239
|
}
|
|
247
240
|
/**
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const MALLOY_VERSION = "0.0.
|
|
1
|
+
export declare const MALLOY_VERSION = "0.0.435";
|
package/dist/version.js
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MALLOY_VERSION = void 0;
|
|
4
4
|
// generated with 'generate-version-file' script; do not edit manually
|
|
5
|
-
exports.MALLOY_VERSION = '0.0.
|
|
5
|
+
exports.MALLOY_VERSION = '0.0.435';
|
|
6
6
|
//# sourceMappingURL=version.js.map
|
package/femto-config.motly
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# Config format: node ../../scripts/femto-build.js --help
|
|
2
|
+
|
|
1
3
|
lexer: {
|
|
2
4
|
inputs = ["src/lang/grammar/MalloyLexer.g4"]
|
|
3
5
|
outputs = ["src/lang/lib/Malloy/MalloyLexer.ts"]
|
|
@@ -26,6 +28,18 @@ tokenNames: {
|
|
|
26
28
|
commands = ["node src/lang/grammar/build_token_names.js"]
|
|
27
29
|
}
|
|
28
30
|
|
|
31
|
+
# A pure function of the two CLDR files, so a cldr-core/cldr-bcp47 bump
|
|
32
|
+
# regenerates it on the next build.
|
|
33
|
+
windowsZones: {
|
|
34
|
+
inputs = [
|
|
35
|
+
"src/dialect/sqlserver/build_windows_zones.js",
|
|
36
|
+
"../../node_modules/cldr-core/supplemental/windowsZones.json",
|
|
37
|
+
"../../node_modules/cldr-bcp47/bcp47/timezone.json"
|
|
38
|
+
]
|
|
39
|
+
outputs = ["src/dialect/sqlserver/windows_zones.ts"]
|
|
40
|
+
commands = ["node src/dialect/sqlserver/build_windows_zones.js"]
|
|
41
|
+
}
|
|
42
|
+
|
|
29
43
|
codegen: {
|
|
30
|
-
deps = [parser, tokenNames]
|
|
44
|
+
deps = [parser, tokenNames, windowsZones]
|
|
31
45
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@malloydata/malloy",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.435",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dist/index.js",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"url": "https://github.com/malloydata/malloy"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
|
-
"test": "
|
|
43
|
+
"test": "echo 'Read the Testing section of the repo-root CONTEXT.md for information on testing in this monorepo'; exit 1",
|
|
44
44
|
"codegen": "node ../../scripts/femto-build.js codegen",
|
|
45
45
|
"build-parser": "node src/lang/grammar/build_parser.js",
|
|
46
46
|
"clean": "tsc --build --clean && rm -f tsconfig.tsbuildinfo && node ../../scripts/femto-build.js --clean && rm -rf src/lang/lib dist",
|
|
@@ -51,9 +51,9 @@
|
|
|
51
51
|
"generate-version-file": "VERSION=$(npm pkg get version --workspaces=false | tr -d \\\")\necho \"// generated with 'generate-version-file' script; do not edit manually\\nexport const MALLOY_VERSION = '$VERSION';\" > src/version.ts"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@malloydata/malloy-filter": "0.0.
|
|
55
|
-
"@malloydata/malloy-interfaces": "0.0.
|
|
56
|
-
"@malloydata/malloy-tag": "0.0.
|
|
54
|
+
"@malloydata/malloy-filter": "0.0.435",
|
|
55
|
+
"@malloydata/malloy-interfaces": "0.0.435",
|
|
56
|
+
"@malloydata/malloy-tag": "0.0.435",
|
|
57
57
|
"@noble/hashes": "^1.8.0",
|
|
58
58
|
"antlr4ts": "^0.5.0-alpha.4",
|
|
59
59
|
"assert": "^2.0.0",
|
|
@@ -67,6 +67,8 @@
|
|
|
67
67
|
"@types/lodash": "^4.17.24",
|
|
68
68
|
"@types/luxon": "^3.7.2",
|
|
69
69
|
"antlr4ts-cli": "^0.5.0-alpha.4",
|
|
70
|
+
"cldr-bcp47": "^48.2.0",
|
|
71
|
+
"cldr-core": "^48.2.0",
|
|
70
72
|
"jest-diff": "^30.4.1"
|
|
71
73
|
}
|
|
72
74
|
}
|