@malloydata/malloy 0.0.142-dev240412191256 → 0.0.142
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/dialect/dialect.d.ts +1 -0
- package/dist/dialect/dialect.js +2 -0
- package/dist/dialect/functions/util.d.ts +1 -2
- package/dist/dialect/functions/util.js +4 -11
- package/dist/dialect/trino/functions/chr.d.ts +4 -0
- package/dist/dialect/trino/functions/chr.js +45 -0
- package/dist/dialect/trino/functions/concat.js +1 -1
- package/dist/dialect/trino/functions/div.d.ts +2 -0
- package/dist/dialect/trino/functions/div.js +36 -0
- package/dist/dialect/trino/functions/is_inf.d.ts +2 -0
- package/dist/dialect/trino/functions/is_inf.js +33 -0
- package/dist/dialect/trino/functions/repeat.d.ts +2 -0
- package/dist/dialect/trino/functions/repeat.js +35 -0
- package/dist/dialect/trino/functions/reverse.d.ts +2 -0
- package/dist/dialect/trino/functions/reverse.js +34 -0
- package/dist/dialect/trino/functions/starts_ends_with.d.ts +3 -0
- package/dist/dialect/trino/functions/starts_ends_with.js +43 -0
- package/dist/dialect/trino/functions/trino_functions.js +15 -0
- package/dist/dialect/trino/trino.d.ts +1 -0
- package/dist/dialect/trino/trino.js +1 -0
- package/dist/model/malloy_types.d.ts +2 -0
- package/package.json +1 -1
|
@@ -54,6 +54,7 @@ export declare abstract class Dialect {
|
|
|
54
54
|
nullMatchesFunctionSignature: boolean;
|
|
55
55
|
supportsSelectReplace: boolean;
|
|
56
56
|
supportsComplexFilteredSources: boolean;
|
|
57
|
+
supportsTempTables: boolean;
|
|
57
58
|
abstract getGlobalFunctionDef(name: string): DialectFunctionOverloadDef[] | undefined;
|
|
58
59
|
abstract quoteTablePath(tablePath: string): string;
|
|
59
60
|
abstract sqlGroupSetTable(groupSetCount: number): string;
|
package/dist/dialect/dialect.js
CHANGED
|
@@ -76,6 +76,8 @@ class Dialect {
|
|
|
76
76
|
this.supportsSelectReplace = true;
|
|
77
77
|
// ability to join source with a filter on a joined source.
|
|
78
78
|
this.supportsComplexFilteredSources = true;
|
|
79
|
+
// can create temp tables
|
|
80
|
+
this.supportsTempTables = true;
|
|
79
81
|
}
|
|
80
82
|
sqlFinalStage(_lastStageName, _fields) {
|
|
81
83
|
throw new Error('Dialect has no final Stage but called Anyway');
|
|
@@ -14,8 +14,7 @@ export interface DialectFunctionOverloadDef {
|
|
|
14
14
|
} | undefined;
|
|
15
15
|
}
|
|
16
16
|
export declare function arg(name: string): Fragment;
|
|
17
|
-
export declare function spread(f: Fragment): Fragment;
|
|
18
|
-
export declare function spreadCast(f: Fragment, _destType: string): Fragment;
|
|
17
|
+
export declare function spread(f: Fragment, prefix?: string | undefined, suffix?: string | undefined): Fragment;
|
|
19
18
|
/**
|
|
20
19
|
* Prefer `sql` when possible.
|
|
21
20
|
*/
|
|
@@ -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.overload = exports.minAnalytic = exports.minAggregate = exports.minScalar = exports.maxAnalytic = exports.maxUngroupedAggregate = exports.anyExprType = exports.maxAggregate = exports.maxScalar = exports.makeParam = exports.param = exports.params = exports.literal = exports.output = exports.constant = exports.sql = exports.sqlFragment = exports.
|
|
25
|
+
exports.overload = exports.minAnalytic = exports.minAggregate = exports.minScalar = exports.maxAnalytic = exports.maxUngroupedAggregate = exports.anyExprType = exports.maxAggregate = exports.maxScalar = exports.makeParam = exports.param = exports.params = exports.literal = exports.output = exports.constant = exports.sql = exports.sqlFragment = exports.spread = exports.arg = void 0;
|
|
26
26
|
function arg(name) {
|
|
27
27
|
return {
|
|
28
28
|
type: 'function_parameter',
|
|
@@ -30,22 +30,15 @@ function arg(name) {
|
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
exports.arg = arg;
|
|
33
|
-
function spread(f) {
|
|
33
|
+
function spread(f, prefix = undefined, suffix = undefined) {
|
|
34
34
|
return {
|
|
35
35
|
type: 'spread',
|
|
36
36
|
e: [f],
|
|
37
|
+
prefix,
|
|
38
|
+
suffix,
|
|
37
39
|
};
|
|
38
40
|
}
|
|
39
41
|
exports.spread = spread;
|
|
40
|
-
// LTABB: this doesn't work, needs to be rewriten in terms of function parameters.
|
|
41
|
-
function spreadCast(f, _destType) {
|
|
42
|
-
return {
|
|
43
|
-
type: 'spread',
|
|
44
|
-
e: [f],
|
|
45
|
-
// e: ['CAST(', f, `AS ${destType})`],
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
exports.spreadCast = spreadCast;
|
|
49
42
|
/**
|
|
50
43
|
* Prefer `sql` when possible.
|
|
51
44
|
*/
|
|
@@ -0,0 +1,45 @@
|
|
|
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.fnUnicode = exports.fnAscii = exports.fnChr = void 0;
|
|
26
|
+
const util_1 = require("../../functions/util");
|
|
27
|
+
function fnChr() {
|
|
28
|
+
return [
|
|
29
|
+
(0, util_1.overload)((0, util_1.minScalar)('string'), [(0, util_1.param)('value', (0, util_1.anyExprType)('number'))], (0, util_1.sql) `CASE WHEN ${(0, util_1.arg)('value')} = 0 THEN '' ELSE CHR(${(0, util_1.arg)('value')}) END`),
|
|
30
|
+
];
|
|
31
|
+
}
|
|
32
|
+
exports.fnChr = fnChr;
|
|
33
|
+
function fnAscii() {
|
|
34
|
+
return [
|
|
35
|
+
(0, util_1.overload)((0, util_1.minScalar)('number'), [(0, util_1.param)('value', (0, util_1.anyExprType)('string'))], (0, util_1.sql) `CODEPOINT(NULLIF(CAST(${(0, util_1.arg)('value')} as VARCHAR(1)),''))`),
|
|
36
|
+
];
|
|
37
|
+
}
|
|
38
|
+
exports.fnAscii = fnAscii;
|
|
39
|
+
function fnUnicode() {
|
|
40
|
+
return [
|
|
41
|
+
(0, util_1.overload)((0, util_1.minScalar)('number'), [(0, util_1.param)('value', (0, util_1.anyExprType)('string'))], (0, util_1.sql) `CODEPOINT(NULLIF(CAST(${(0, util_1.arg)('value')} as VARCHAR(1)),''))`),
|
|
42
|
+
];
|
|
43
|
+
}
|
|
44
|
+
exports.fnUnicode = fnUnicode;
|
|
45
|
+
//# sourceMappingURL=chr.js.map
|
|
@@ -31,7 +31,7 @@ function fnConcat() {
|
|
|
31
31
|
(0, util_1.overload)((0, util_1.minScalar)('string'), [], [{ type: 'dialect', function: 'stringLiteral', literal: '' }]),
|
|
32
32
|
(0, util_1.overload)((0, util_1.minScalar)('string'), [
|
|
33
33
|
(0, util_1.params)('values', (0, util_1.anyExprType)('string'), (0, util_1.anyExprType)('number'), (0, util_1.anyExprType)('date'), (0, util_1.anyExprType)('timestamp'), (0, util_1.anyExprType)('boolean')),
|
|
34
|
-
], (0, util_1.sql) `CONCAT(${(0, util_1.
|
|
34
|
+
], (0, util_1.sql) `CONCAT(${(0, util_1.spread)((0, util_1.arg)('values'), 'CAST(', 'AS VARCHAR)')})`),
|
|
35
35
|
];
|
|
36
36
|
}
|
|
37
37
|
exports.fnConcat = fnConcat;
|
|
@@ -0,0 +1,36 @@
|
|
|
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.fnDiv = void 0;
|
|
26
|
+
const util_1 = require("../../functions/util");
|
|
27
|
+
function fnDiv() {
|
|
28
|
+
return [
|
|
29
|
+
(0, util_1.overload)((0, util_1.minScalar)('number'), [
|
|
30
|
+
(0, util_1.param)('dividend', (0, util_1.anyExprType)('number')),
|
|
31
|
+
(0, util_1.param)('divisor', (0, util_1.anyExprType)('number')),
|
|
32
|
+
], (0, util_1.sql) `FLOOR(${(0, util_1.arg)('dividend')} / ${(0, util_1.arg)('divisor')})`),
|
|
33
|
+
];
|
|
34
|
+
}
|
|
35
|
+
exports.fnDiv = fnDiv;
|
|
36
|
+
//# sourceMappingURL=div.js.map
|
|
@@ -0,0 +1,33 @@
|
|
|
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.fnIsInf = void 0;
|
|
26
|
+
const util_1 = require("../../functions/util");
|
|
27
|
+
function fnIsInf() {
|
|
28
|
+
return [
|
|
29
|
+
(0, util_1.overload)((0, util_1.minScalar)('boolean'), [(0, util_1.param)('value', (0, util_1.anyExprType)('number'))], (0, util_1.sql) `COALESCE(IS_INFINITE(${(0, util_1.arg)('value')}), false)`),
|
|
30
|
+
];
|
|
31
|
+
}
|
|
32
|
+
exports.fnIsInf = fnIsInf;
|
|
33
|
+
//# sourceMappingURL=is_inf.js.map
|
|
@@ -0,0 +1,35 @@
|
|
|
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.fnRepeat = void 0;
|
|
26
|
+
const util_1 = require("../../functions/util");
|
|
27
|
+
function fnRepeat() {
|
|
28
|
+
const value = (0, util_1.makeParam)('value', (0, util_1.anyExprType)('string'));
|
|
29
|
+
const count = (0, util_1.makeParam)('count', (0, util_1.anyExprType)('number'));
|
|
30
|
+
return [
|
|
31
|
+
(0, util_1.overload)((0, util_1.minScalar)('string'), [value.param, count.param], (0, util_1.sql) `ARRAY_JOIN(REPEAT(${value.arg}, CASE WHEN ${value.arg} IS NOT NULL THEN ${count.arg} END),'')`),
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
exports.fnRepeat = fnRepeat;
|
|
35
|
+
//# sourceMappingURL=repeat.js.map
|
|
@@ -0,0 +1,34 @@
|
|
|
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.fnReverse = void 0;
|
|
26
|
+
const util_1 = require("../../functions/util");
|
|
27
|
+
function fnReverse() {
|
|
28
|
+
const value = (0, util_1.makeParam)('value', (0, util_1.anyExprType)('string'));
|
|
29
|
+
return [
|
|
30
|
+
(0, util_1.overload)((0, util_1.minScalar)('string'), [value.param], (0, util_1.sql) `REVERSE(CAST(${value.arg} AS VARCHAR))`),
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
exports.fnReverse = fnReverse;
|
|
34
|
+
//# sourceMappingURL=reverse.js.map
|
|
@@ -0,0 +1,43 @@
|
|
|
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.fnEndsWith = exports.fnStartsWith = void 0;
|
|
26
|
+
const util_1 = require("../../functions/util");
|
|
27
|
+
function fnStartsWith() {
|
|
28
|
+
const value = (0, util_1.makeParam)('value', (0, util_1.anyExprType)('string'));
|
|
29
|
+
const prefix = (0, util_1.makeParam)('prefix', (0, util_1.anyExprType)('string'));
|
|
30
|
+
return [
|
|
31
|
+
(0, util_1.overload)((0, util_1.minScalar)('boolean'), [value.param, prefix.param], (0, util_1.sql) `COALESCE(STARTS_WITH(${value.arg}, ${prefix.arg}), false)`),
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
exports.fnStartsWith = fnStartsWith;
|
|
35
|
+
function fnEndsWith() {
|
|
36
|
+
const value = (0, util_1.makeParam)('value', (0, util_1.anyExprType)('string'));
|
|
37
|
+
const suffix = (0, util_1.makeParam)('suffix', (0, util_1.anyExprType)('string'));
|
|
38
|
+
return [
|
|
39
|
+
(0, util_1.overload)((0, util_1.minScalar)('boolean'), [value.param, suffix.param], (0, util_1.sql) `COALESCE(STARTS_WITH(REVERSE(CAST(${value.arg} AS VARCHAR)), REVERSE(CAST(${suffix.arg} AS VARCHAR))), false)`),
|
|
40
|
+
];
|
|
41
|
+
}
|
|
42
|
+
exports.fnEndsWith = fnEndsWith;
|
|
43
|
+
//# sourceMappingURL=starts_ends_with.js.map
|
|
@@ -27,16 +27,31 @@ const functions_1 = require("../../functions");
|
|
|
27
27
|
const trunc_1 = require("./trunc");
|
|
28
28
|
const log_1 = require("./log");
|
|
29
29
|
const ifnull_1 = require("./ifnull");
|
|
30
|
+
const is_inf_1 = require("./is_inf");
|
|
30
31
|
const concat_1 = require("./concat");
|
|
31
32
|
const byte_length_1 = require("./byte_length");
|
|
32
33
|
const string_agg_1 = require("./string_agg");
|
|
34
|
+
const chr_1 = require("./chr");
|
|
35
|
+
const starts_ends_with_1 = require("./starts_ends_with");
|
|
36
|
+
const div_1 = require("./div");
|
|
37
|
+
const repeat_1 = require("./repeat");
|
|
38
|
+
const reverse_1 = require("./reverse");
|
|
33
39
|
exports.TRINO_FUNCTIONS = functions_1.FUNCTIONS.clone();
|
|
34
40
|
exports.TRINO_FUNCTIONS.add('trunc', trunc_1.fnTrunc);
|
|
35
41
|
exports.TRINO_FUNCTIONS.add('log', log_1.fnLog);
|
|
36
42
|
exports.TRINO_FUNCTIONS.add('ifnull', ifnull_1.fnIfnull);
|
|
43
|
+
exports.TRINO_FUNCTIONS.add('is_inf', is_inf_1.fnIsInf);
|
|
37
44
|
exports.TRINO_FUNCTIONS.add('byte_length', byte_length_1.fnByteLength);
|
|
38
45
|
exports.TRINO_FUNCTIONS.add('concat', concat_1.fnConcat);
|
|
39
46
|
exports.TRINO_FUNCTIONS.add('string_agg', string_agg_1.fnStringAgg);
|
|
40
47
|
exports.TRINO_FUNCTIONS.add('string_agg_distinct', string_agg_1.fnStringAggDistinct);
|
|
48
|
+
exports.TRINO_FUNCTIONS.add('div', div_1.fnDiv);
|
|
49
|
+
exports.TRINO_FUNCTIONS.add('starts_with', starts_ends_with_1.fnStartsWith);
|
|
50
|
+
exports.TRINO_FUNCTIONS.add('ends_with', starts_ends_with_1.fnEndsWith);
|
|
51
|
+
exports.TRINO_FUNCTIONS.add('chr', chr_1.fnChr);
|
|
52
|
+
exports.TRINO_FUNCTIONS.add('ascii', chr_1.fnAscii);
|
|
53
|
+
exports.TRINO_FUNCTIONS.add('unicode', chr_1.fnUnicode);
|
|
54
|
+
exports.TRINO_FUNCTIONS.add('repeat', repeat_1.fnRepeat);
|
|
55
|
+
exports.TRINO_FUNCTIONS.add('reverse', reverse_1.fnReverse);
|
|
41
56
|
exports.TRINO_FUNCTIONS.seal();
|
|
42
57
|
//# sourceMappingURL=trino_functions.js.map
|
|
@@ -25,6 +25,7 @@ export declare class TrinoDialect extends Dialect {
|
|
|
25
25
|
nullMatchesFunctionSignature: boolean;
|
|
26
26
|
supportsSelectReplace: boolean;
|
|
27
27
|
supportsComplexFilteredSources: boolean;
|
|
28
|
+
supportsTempTables: boolean;
|
|
28
29
|
quoteTablePath(tablePath: string): string;
|
|
29
30
|
sqlGroupSetTable(groupSetCount: number): string;
|
|
30
31
|
dialectExpr(qi: QueryInfo, df: DialectFragment): Expr;
|
|
@@ -79,6 +79,7 @@ class TrinoDialect extends dialect_1.Dialect {
|
|
|
79
79
|
this.nullMatchesFunctionSignature = false;
|
|
80
80
|
this.supportsSelectReplace = false;
|
|
81
81
|
this.supportsComplexFilteredSources = false;
|
|
82
|
+
this.supportsTempTables = false;
|
|
82
83
|
// TODO(figutierrez): update.
|
|
83
84
|
this.keywords = `
|
|
84
85
|
ALL
|
|
@@ -152,6 +152,8 @@ export declare function isSQLExpressionFragment(f: Fragment): f is SQLExpression
|
|
|
152
152
|
export interface SpreadFragment {
|
|
153
153
|
type: 'spread';
|
|
154
154
|
e: Expr;
|
|
155
|
+
prefix: string | undefined;
|
|
156
|
+
suffix: string | undefined;
|
|
155
157
|
}
|
|
156
158
|
export declare function isSpreadFragment(f: Fragment): f is SpreadFragment;
|
|
157
159
|
export interface FieldFragment {
|