@malloydata/malloy 0.0.22-dev230126015148 → 0.0.22-dev230206094309
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/package.json +2 -2
- package/dist/connection_utils.d.ts +0 -1
- package/dist/connection_utils.js +0 -66
- package/dist/dialect/dialect.d.ts +0 -66
- package/dist/dialect/dialect.js +0 -85
- package/dist/dialect/dialect_map.d.ts +0 -3
- package/dist/dialect/dialect_map.js +0 -45
- package/dist/dialect/duckdb.d.ts +0 -52
- package/dist/dialect/duckdb.js +0 -364
- package/dist/dialect/index.d.ts +0 -6
- package/dist/dialect/index.js +0 -37
- package/dist/dialect/postgres.d.ts +0 -52
- package/dist/dialect/postgres.js +0 -330
- package/dist/dialect/standardsql.d.ts +0 -49
- package/dist/dialect/standardsql.js +0 -381
- package/dist/index.d.ts +0 -10
- package/dist/index.js +0 -59
- package/dist/lang/ast/apply-expr.d.ts +0 -3
- package/dist/lang/ast/apply-expr.js +0 -34
- package/dist/lang/ast/ast-expr.d.ts +0 -206
- package/dist/lang/ast/ast-expr.js +0 -781
- package/dist/lang/ast/ast-main.d.ts +0 -915
- package/dist/lang/ast/ast-main.js +0 -3672
- package/dist/lang/ast/ast-time-expr.d.ts +0 -69
- package/dist/lang/ast/ast-time-expr.js +0 -389
- package/dist/lang/ast/ast-types.d.ts +0 -83
- package/dist/lang/ast/ast-types.js +0 -225
- package/dist/lang/ast/index.d.ts +0 -5
- package/dist/lang/ast/index.js +0 -44
- package/dist/lang/ast/time-utils.d.ts +0 -9
- package/dist/lang/ast/time-utils.js +0 -104
- package/dist/lang/field-utils.d.ts +0 -5
- package/dist/lang/field-utils.js +0 -43
- package/dist/lang/index.d.ts +0 -9
- package/dist/lang/index.js +0 -32
- package/dist/lang/lib/Malloy/MalloyLexer.d.ts +0 -165
- package/dist/lang/lib/Malloy/MalloyLexer.js +0 -1232
- package/dist/lang/lib/Malloy/MalloyParser.d.ts +0 -1947
- package/dist/lang/lib/Malloy/MalloyParser.js +0 -11909
- package/dist/lang/lib/Malloy/MalloyParserListener.d.ts +0 -2022
- package/dist/lang/lib/Malloy/MalloyParserListener.js +0 -4
- package/dist/lang/lib/Malloy/MalloyParserVisitor.d.ts +0 -1274
- package/dist/lang/lib/Malloy/MalloyParserVisitor.js +0 -4
- package/dist/lang/parse-log.d.ts +0 -27
- package/dist/lang/parse-log.js +0 -51
- package/dist/lang/parse-malloy.d.ts +0 -236
- package/dist/lang/parse-malloy.js +0 -746
- package/dist/lang/parse-to-ast.d.ts +0 -155
- package/dist/lang/parse-to-ast.js +0 -990
- package/dist/lang/parse-tree-walkers/document-completion-walker.d.ts +0 -10
- package/dist/lang/parse-tree-walkers/document-completion-walker.js +0 -148
- package/dist/lang/parse-tree-walkers/document-help-context-walker.d.ts +0 -9
- package/dist/lang/parse-tree-walkers/document-help-context-walker.js +0 -107
- package/dist/lang/parse-tree-walkers/document-highlight-walker.d.ts +0 -83
- package/dist/lang/parse-tree-walkers/document-highlight-walker.js +0 -385
- package/dist/lang/parse-tree-walkers/document-symbol-walker.d.ts +0 -11
- package/dist/lang/parse-tree-walkers/document-symbol-walker.js +0 -182
- package/dist/lang/parse-tree-walkers/explore-query-walker.d.ts +0 -34
- package/dist/lang/parse-tree-walkers/explore-query-walker.js +0 -74
- package/dist/lang/parse-tree-walkers/find-external-references.d.ts +0 -11
- package/dist/lang/parse-tree-walkers/find-external-references.js +0 -61
- package/dist/lang/reference-list.d.ts +0 -10
- package/dist/lang/reference-list.js +0 -90
- package/dist/lang/space-field.d.ts +0 -17
- package/dist/lang/space-field.js +0 -127
- package/dist/lang/test/document-help-context-walker.spec.d.ts +0 -1
- package/dist/lang/test/document-help-context-walker.spec.js +0 -55
- package/dist/lang/test/document-symbol-walker.spec.d.ts +0 -1
- package/dist/lang/test/document-symbol-walker.spec.js +0 -110
- package/dist/lang/test/field-symbols.spec.d.ts +0 -1
- package/dist/lang/test/field-symbols.spec.js +0 -180
- package/dist/lang/test/parse.spec.d.ts +0 -14
- package/dist/lang/test/parse.spec.js +0 -2134
- package/dist/lang/test/test-translator.d.ts +0 -38
- package/dist/lang/test/test-translator.js +0 -344
- package/dist/lang/zone.d.ts +0 -57
- package/dist/lang/zone.js +0 -107
- package/dist/malloy.d.ts +0 -1146
- package/dist/malloy.js +0 -2413
- package/dist/model/index.d.ts +0 -2
- package/dist/model/index.js +0 -45
- package/dist/model/malloy_query.d.ts +0 -351
- package/dist/model/malloy_query.js +0 -3174
- package/dist/model/malloy_types.d.ts +0 -551
- package/dist/model/malloy_types.js +0 -378
- package/dist/model/sql_block.d.ts +0 -7
- package/dist/model/sql_block.js +0 -56
- package/dist/model/utils.d.ts +0 -22
- package/dist/model/utils.js +0 -102
- package/dist/run_sql_options.d.ts +0 -3
- package/dist/run_sql_options.js +0 -25
- package/dist/runtime_types.d.ts +0 -105
- package/dist/runtime_types.js +0 -25
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@malloydata/malloy",
|
|
3
|
-
"version": "0.0.22-
|
|
3
|
+
"version": "0.0.22-dev230206094309",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"test": "jest --config=../../jest.config.js",
|
|
14
14
|
"build-parser": "node src/lang/grammar/build_parser.js",
|
|
15
15
|
"testLang": "npm run test --testPathPattern=packages/malloy/src/lang",
|
|
16
|
-
"clean": "rm -rf src/lang/lib",
|
|
16
|
+
"clean": "rm -rf src/lang/lib dist",
|
|
17
17
|
"build": "npm run build-parser && tsc --build",
|
|
18
18
|
"malloyc": "ts-node ../../scripts/malloy-to-json",
|
|
19
19
|
"prepublishOnly": "npm run clean && npm run build"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function toAsyncGenerator<T>(startStreaming: (onError: (error: Error) => void, onData: (data: T) => void, onEnd: () => void) => void): AsyncIterableIterator<T>;
|
package/dist/connection_utils.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright 2023 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
-
* a copy of this software and associated documentation files
|
|
7
|
-
* (the "Software"), to deal in the Software without restriction,
|
|
8
|
-
* including without limitation the rights to use, copy, modify, merge,
|
|
9
|
-
* publish, distribute, sublicense, and/or sell copies of the Software,
|
|
10
|
-
* and to permit persons to whom the Software is furnished to do so,
|
|
11
|
-
* subject to the following conditions:
|
|
12
|
-
*
|
|
13
|
-
* The above copyright notice and this permission notice shall be
|
|
14
|
-
* included in all copies or substantial portions of the Software.
|
|
15
|
-
*
|
|
16
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
-
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
-
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
-
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
-
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
-
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
-
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.toAsyncGenerator = void 0;
|
|
26
|
-
async function* toAsyncGenerator(startStreaming) {
|
|
27
|
-
let done = false;
|
|
28
|
-
function getResults(startStreaming) {
|
|
29
|
-
let resolve;
|
|
30
|
-
const promise = new Promise((res) => {
|
|
31
|
-
resolve = res;
|
|
32
|
-
});
|
|
33
|
-
startStreaming((error) => {
|
|
34
|
-
resolve({ done: true, isError: true, error });
|
|
35
|
-
}, (data) => {
|
|
36
|
-
resolve({
|
|
37
|
-
done: false,
|
|
38
|
-
value: data,
|
|
39
|
-
isError: false,
|
|
40
|
-
next: new Promise((res) => {
|
|
41
|
-
resolve = res;
|
|
42
|
-
}),
|
|
43
|
-
});
|
|
44
|
-
}, () => {
|
|
45
|
-
resolve({ done: true, isError: false });
|
|
46
|
-
});
|
|
47
|
-
return promise;
|
|
48
|
-
}
|
|
49
|
-
let next = getResults(startStreaming);
|
|
50
|
-
while (!done) {
|
|
51
|
-
const result = await next;
|
|
52
|
-
if (result.done) {
|
|
53
|
-
done = true;
|
|
54
|
-
if (result.isError) {
|
|
55
|
-
throw result.error;
|
|
56
|
-
}
|
|
57
|
-
break;
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
next = result.next;
|
|
61
|
-
yield result.value;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
exports.toAsyncGenerator = toAsyncGenerator;
|
|
66
|
-
//# sourceMappingURL=connection_utils.js.map
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { AtomicFieldType as AtomicFieldTypeInner, TimeFieldType, TimestampUnit, ExtractUnit, DialectFragment, TimeValue, Expr, Sampling, StructDef, TypecastFragment } from "../model/malloy_types";
|
|
2
|
-
interface DialectField {
|
|
3
|
-
type: string;
|
|
4
|
-
sqlExpression: string;
|
|
5
|
-
sqlOutputName: string;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Someday this might be used to control how a function call in malloy is
|
|
9
|
-
* translated into a function call in SQL. Today this is just so that
|
|
10
|
-
* the expression compiler can know the output type of a function.
|
|
11
|
-
*/
|
|
12
|
-
export interface FunctionInfo {
|
|
13
|
-
returnType: AtomicFieldTypeInner;
|
|
14
|
-
}
|
|
15
|
-
export declare type DialectFieldList = DialectField[];
|
|
16
|
-
export declare abstract class Dialect {
|
|
17
|
-
abstract name: string;
|
|
18
|
-
abstract defaultNumberType: string;
|
|
19
|
-
abstract udfPrefix: string;
|
|
20
|
-
abstract hasFinalStage: boolean;
|
|
21
|
-
abstract stringTypeName: string;
|
|
22
|
-
abstract divisionIsInteger: boolean;
|
|
23
|
-
abstract supportsSumDistinctFunction: boolean;
|
|
24
|
-
abstract unnestWithNumbers: boolean;
|
|
25
|
-
protected abstract functionInfo: Record<string, FunctionInfo>;
|
|
26
|
-
abstract defaultSampling: Sampling;
|
|
27
|
-
abstract supportUnnestArrayAgg: boolean;
|
|
28
|
-
abstract supportsCTEinCoorelatedSubQueries: boolean;
|
|
29
|
-
abstract dontUnionIndex: boolean;
|
|
30
|
-
abstract supportsQualify: boolean;
|
|
31
|
-
abstract quoteTablePath(tablePath: string): string;
|
|
32
|
-
abstract sqlGroupSetTable(groupSetCount: number): string;
|
|
33
|
-
abstract sqlAnyValue(groupSet: number, fieldName: string): string;
|
|
34
|
-
abstract sqlAggregateTurtle(groupSet: number, fieldList: DialectFieldList, orderBy: string | undefined, limit: number | undefined): string;
|
|
35
|
-
abstract sqlAnyValueTurtle(groupSet: number, fieldList: DialectFieldList): string;
|
|
36
|
-
abstract sqlAnyValueLastTurtle(name: string, groupSet: number, sqlName: string): string;
|
|
37
|
-
abstract sqlCoaleseMeasuresInline(groupSet: number, fieldList: DialectFieldList): string;
|
|
38
|
-
abstract sqlUnnestAlias(source: string, alias: string, fieldList: DialectFieldList, needDistinctKey: boolean, isArray: boolean): string;
|
|
39
|
-
abstract sqlSumDistinctHashedKey(sqlDistinctKey: string): string;
|
|
40
|
-
abstract sqlGenerateUUID(): string;
|
|
41
|
-
abstract sqlFieldReference(alias: string, fieldName: string, fieldType: string, isNested: boolean, isArray: boolean): string;
|
|
42
|
-
abstract sqlUnnestPipelineHead(isSingleton: boolean, sourceSQLExpression: string): string;
|
|
43
|
-
abstract sqlCreateFunction(id: string, funcText: string): string;
|
|
44
|
-
abstract sqlCreateFunctionCombineLastStage(lastStageName: string, structDef: StructDef): string;
|
|
45
|
-
abstract sqlCreateTableAsSelect(tableName: string, sql: string): string;
|
|
46
|
-
abstract sqlSelectAliasAsStruct(alias: string, physicalFieldNames: string[]): string;
|
|
47
|
-
sqlFinalStage(_lastStageName: string, _fields: string[]): string;
|
|
48
|
-
sqlDateToString(sqlDateExp: string): string;
|
|
49
|
-
abstract sqlMaybeQuoteIdentifier(identifier: string): string;
|
|
50
|
-
abstract sqlNow(): Expr;
|
|
51
|
-
abstract sqlTrunc(sqlTime: TimeValue, units: TimestampUnit): Expr;
|
|
52
|
-
abstract sqlExtract(sqlTime: TimeValue, units: ExtractUnit): Expr;
|
|
53
|
-
abstract sqlMeasureTime(from: TimeValue, to: TimeValue, units: TimestampUnit): Expr;
|
|
54
|
-
abstract sqlAlterTime(op: "+" | "-", expr: TimeValue, n: Expr, timeframe: TimestampUnit): Expr;
|
|
55
|
-
ignoreInProject(_fieldName: string): boolean;
|
|
56
|
-
abstract sqlCast(cast: TypecastFragment): Expr;
|
|
57
|
-
abstract sqlLiteralTime(timeString: string, type: TimeFieldType, timezone: string): string;
|
|
58
|
-
abstract sqlLiteralString(literak: string): string;
|
|
59
|
-
abstract sqlRegexpMatch(expr: Expr, regex: string): Expr;
|
|
60
|
-
getFunctionInfo(functionName: string): FunctionInfo | undefined;
|
|
61
|
-
dialectExpr(df: DialectFragment): Expr;
|
|
62
|
-
sqlSumDistinct(_key: string, _value: string): string;
|
|
63
|
-
sqlSampleTable(tableSQL: string, sample: Sampling | undefined): string;
|
|
64
|
-
sqlOrderBy(orderTerms: string[]): string;
|
|
65
|
-
}
|
|
66
|
-
export {};
|
package/dist/dialect/dialect.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright 2023 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
-
* a copy of this software and associated documentation files
|
|
7
|
-
* (the "Software"), to deal in the Software without restriction,
|
|
8
|
-
* including without limitation the rights to use, copy, modify, merge,
|
|
9
|
-
* publish, distribute, sublicense, and/or sell copies of the Software,
|
|
10
|
-
* and to permit persons to whom the Software is furnished to do so,
|
|
11
|
-
* subject to the following conditions:
|
|
12
|
-
*
|
|
13
|
-
* The above copyright notice and this permission notice shall be
|
|
14
|
-
* included in all copies or substantial portions of the Software.
|
|
15
|
-
*
|
|
16
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
-
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
-
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
-
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
-
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
-
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
-
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.Dialect = void 0;
|
|
26
|
-
const malloy_types_1 = require("../model/malloy_types");
|
|
27
|
-
class Dialect {
|
|
28
|
-
sqlFinalStage(_lastStageName, _fields) {
|
|
29
|
-
throw new Error("Dialect has no final Stage but called Anyway");
|
|
30
|
-
}
|
|
31
|
-
// default implementation will probably work most of the time
|
|
32
|
-
sqlDateToString(sqlDateExp) {
|
|
33
|
-
return `CAST(DATE(${sqlDateExp}) AS ${this.stringTypeName} )`;
|
|
34
|
-
}
|
|
35
|
-
// BigQuery has some fieldNames that are Pseudo Fields and shouldn't be
|
|
36
|
-
// included in projections.
|
|
37
|
-
ignoreInProject(_fieldName) {
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
getFunctionInfo(functionName) {
|
|
41
|
-
return this.functionInfo[functionName.toLowerCase()];
|
|
42
|
-
}
|
|
43
|
-
dialectExpr(df) {
|
|
44
|
-
switch (df.function) {
|
|
45
|
-
case "now":
|
|
46
|
-
return this.sqlNow();
|
|
47
|
-
case "timeDiff":
|
|
48
|
-
return this.sqlMeasureTime(df.left, df.right, df.units);
|
|
49
|
-
case "delta":
|
|
50
|
-
return this.sqlAlterTime(df.op, df.base, df.delta, df.units);
|
|
51
|
-
case "trunc":
|
|
52
|
-
return this.sqlTrunc(df.expr, df.units);
|
|
53
|
-
case "extract":
|
|
54
|
-
return this.sqlExtract(df.expr, df.units);
|
|
55
|
-
case "cast":
|
|
56
|
-
return this.sqlCast(df);
|
|
57
|
-
case "regexpMatch":
|
|
58
|
-
return this.sqlRegexpMatch(df.expr, df.regexp);
|
|
59
|
-
case "div": {
|
|
60
|
-
if (this.divisionIsInteger) {
|
|
61
|
-
return (0, malloy_types_1.mkExpr) `${df.numerator}*1.0/${df.denominator}`;
|
|
62
|
-
}
|
|
63
|
-
return (0, malloy_types_1.mkExpr) `${df.numerator}/${df.denominator}`;
|
|
64
|
-
}
|
|
65
|
-
case "timeLiteral":
|
|
66
|
-
return [this.sqlLiteralTime(df.literal, df.literalType, df.timezone)];
|
|
67
|
-
case "stringLiteral":
|
|
68
|
-
return [this.sqlLiteralString(df.literal)];
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
sqlSumDistinct(_key, _value) {
|
|
72
|
-
return "sqlSumDistinct called bu not implemented";
|
|
73
|
-
}
|
|
74
|
-
sqlSampleTable(tableSQL, sample) {
|
|
75
|
-
if (sample !== undefined) {
|
|
76
|
-
throw new Error(`Sampling is not supported on dialect ${this.name}.`);
|
|
77
|
-
}
|
|
78
|
-
return tableSQL;
|
|
79
|
-
}
|
|
80
|
-
sqlOrderBy(orderTerms) {
|
|
81
|
-
return `ORDER BY ${orderTerms.join(",")}`;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
exports.Dialect = Dialect;
|
|
85
|
-
//# sourceMappingURL=dialect.js.map
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright 2023 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
-
* a copy of this software and associated documentation files
|
|
7
|
-
* (the "Software"), to deal in the Software without restriction,
|
|
8
|
-
* including without limitation the rights to use, copy, modify, merge,
|
|
9
|
-
* publish, distribute, sublicense, and/or sell copies of the Software,
|
|
10
|
-
* and to permit persons to whom the Software is furnished to do so,
|
|
11
|
-
* subject to the following conditions:
|
|
12
|
-
*
|
|
13
|
-
* The above copyright notice and this permission notice shall be
|
|
14
|
-
* included in all copies or substantial portions of the Software.
|
|
15
|
-
*
|
|
16
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
-
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
-
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
-
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
-
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
-
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
-
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.registerDialect = exports.getDialect = void 0;
|
|
26
|
-
const duckdb_1 = require("./duckdb");
|
|
27
|
-
const postgres_1 = require("./postgres");
|
|
28
|
-
const standardsql_1 = require("./standardsql");
|
|
29
|
-
const dialectMap = new Map();
|
|
30
|
-
function getDialect(name) {
|
|
31
|
-
const d = dialectMap.get(name);
|
|
32
|
-
if (d === undefined) {
|
|
33
|
-
throw new Error(`Unknown Dialect ${name}`);
|
|
34
|
-
}
|
|
35
|
-
return d;
|
|
36
|
-
}
|
|
37
|
-
exports.getDialect = getDialect;
|
|
38
|
-
function registerDialect(d) {
|
|
39
|
-
dialectMap.set(d.name, d);
|
|
40
|
-
}
|
|
41
|
-
exports.registerDialect = registerDialect;
|
|
42
|
-
registerDialect(new postgres_1.PostgresDialect());
|
|
43
|
-
registerDialect(new standardsql_1.StandardSQLDialect());
|
|
44
|
-
registerDialect(new duckdb_1.DuckDBDialect());
|
|
45
|
-
//# sourceMappingURL=dialect_map.js.map
|
package/dist/dialect/duckdb.d.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { DateUnit, Expr, ExtractUnit, Sampling, StructDef, TimeFieldType, TimestampUnit, TimeValue, TypecastFragment } from "../model/malloy_types";
|
|
2
|
-
import { Dialect, DialectFieldList, FunctionInfo } from "./dialect";
|
|
3
|
-
export declare class DuckDBDialect extends Dialect {
|
|
4
|
-
name: string;
|
|
5
|
-
defaultNumberType: string;
|
|
6
|
-
hasFinalStage: boolean;
|
|
7
|
-
stringTypeName: string;
|
|
8
|
-
divisionIsInteger: boolean;
|
|
9
|
-
supportsSumDistinctFunction: boolean;
|
|
10
|
-
unnestWithNumbers: boolean;
|
|
11
|
-
defaultSampling: {
|
|
12
|
-
rows: number;
|
|
13
|
-
};
|
|
14
|
-
supportUnnestArrayAgg: boolean;
|
|
15
|
-
supportsCTEinCoorelatedSubQueries: boolean;
|
|
16
|
-
dontUnionIndex: boolean;
|
|
17
|
-
supportsQualify: boolean;
|
|
18
|
-
functionInfo: Record<string, FunctionInfo>;
|
|
19
|
-
get udfPrefix(): string;
|
|
20
|
-
quoteTablePath(tableName: string): string;
|
|
21
|
-
sqlGroupSetTable(groupSetCount: number): string;
|
|
22
|
-
sqlAnyValue(groupSet: number, fieldName: string): string;
|
|
23
|
-
mapFields(fieldList: DialectFieldList): string;
|
|
24
|
-
sqlAggregateTurtle(groupSet: number, fieldList: DialectFieldList, orderBy: string | undefined, limit: number | undefined): string;
|
|
25
|
-
sqlAnyValueTurtle(groupSet: number, fieldList: DialectFieldList): string;
|
|
26
|
-
sqlAnyValueLastTurtle(name: string, groupSet: number, sqlName: string): string;
|
|
27
|
-
sqlCoaleseMeasuresInline(groupSet: number, fieldList: DialectFieldList): string;
|
|
28
|
-
sqlUnnestAlias(source: string, alias: string, _fieldList: DialectFieldList, _needDistinctKey: boolean): string;
|
|
29
|
-
sqlSumDistinctHashedKey(_sqlDistinctKey: string): string;
|
|
30
|
-
sqlGenerateUUID(): string;
|
|
31
|
-
sqlDateToString(sqlDateExp: string): string;
|
|
32
|
-
sqlFieldReference(alias: string, fieldName: string, _fieldType: string, _isNested: boolean, isArray: boolean): string;
|
|
33
|
-
sqlUnnestPipelineHead(isSingleton: boolean, sourceSQLExpression: string): string;
|
|
34
|
-
sqlCreateFunction(id: string, funcText: string): string;
|
|
35
|
-
sqlCreateFunctionCombineLastStage(lastStageName: string, structDef: StructDef): string;
|
|
36
|
-
sqlSelectAliasAsStruct(alias: string, physicalFieldNames: string[]): string;
|
|
37
|
-
sqlMaybeQuoteIdentifier(identifier: string): string;
|
|
38
|
-
sqlCreateTableAsSelect(_tableName: string, _sql: string): string;
|
|
39
|
-
getFunctionInfo(functionName: string): FunctionInfo | undefined;
|
|
40
|
-
sqlMeasureTime(from: TimeValue, to: TimeValue, units: string): Expr;
|
|
41
|
-
sqlNow(): Expr;
|
|
42
|
-
sqlTrunc(sqlTime: TimeValue, units: TimestampUnit): Expr;
|
|
43
|
-
sqlExtract(from: TimeValue, units: ExtractUnit): Expr;
|
|
44
|
-
sqlAlterTime(op: "+" | "-", expr: TimeValue, n: Expr, timeframe: DateUnit): Expr;
|
|
45
|
-
sqlCast(cast: TypecastFragment): Expr;
|
|
46
|
-
sqlRegexpMatch(expr: Expr, regexp: string): Expr;
|
|
47
|
-
sqlLiteralTime(timeString: string, type: TimeFieldType, _timezone: string): string;
|
|
48
|
-
sqlSumDistinct(key: string, value: string): string;
|
|
49
|
-
sqlSampleTable(tableSQL: string, sample: Sampling | undefined): string;
|
|
50
|
-
sqlOrderBy(orderTerms: string[]): string;
|
|
51
|
-
sqlLiteralString(literal: string): string;
|
|
52
|
-
}
|