@malloydata/malloy 0.0.149-dev240706223116 → 0.0.149
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.
|
@@ -46,6 +46,7 @@ registerDialect(new standardsql_1.StandardSQLDialect());
|
|
|
46
46
|
registerDialect(new duckdb_1.DuckDBDialect());
|
|
47
47
|
registerDialect(new snowflake_1.SnowflakeDialect());
|
|
48
48
|
registerDialect(new trino_1.TrinoDialect());
|
|
49
|
+
registerDialect(new trino_1.PrestoDialect());
|
|
49
50
|
function paramsEqual(a, b) {
|
|
50
51
|
return (a.params.length === b.params.length &&
|
|
51
52
|
a.params.every((param, i) => {
|
|
@@ -67,3 +67,8 @@ export declare class TrinoDialect extends Dialect {
|
|
|
67
67
|
sqlStringAggDistinct(distinctKey: string, valueSQL: string, separatorSQL: string): string;
|
|
68
68
|
validateTypeName(sqlType: string): boolean;
|
|
69
69
|
}
|
|
70
|
+
export declare class PrestoDialect extends TrinoDialect {
|
|
71
|
+
name: string;
|
|
72
|
+
supportsPipelinesInViews: boolean;
|
|
73
|
+
sqlGenerateUUID(): string;
|
|
74
|
+
}
|
|
@@ -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.TrinoDialect = void 0;
|
|
25
|
+
exports.PrestoDialect = exports.TrinoDialect = void 0;
|
|
26
26
|
const utils_1 = require("../../model/utils");
|
|
27
27
|
const malloy_types_1 = require("../../model/malloy_types");
|
|
28
28
|
const functions_1 = require("./functions");
|
|
@@ -250,17 +250,17 @@ class TrinoDialect extends dialect_1.Dialect {
|
|
|
250
250
|
const fieldsNames = fieldList.map(f => this.sqlMaybeQuoteIdentifier(f.sqlOutputName));
|
|
251
251
|
if (isArray) {
|
|
252
252
|
if (needDistinctKey) {
|
|
253
|
-
return `
|
|
253
|
+
return `CROSS JOIN UNNEST(COALESCE(zip(${source}, SEQUENCE(1,cardinality(${source}))),ARRAY[null])) as words_0(value,__row_id_from_${alias})`;
|
|
254
254
|
}
|
|
255
255
|
else {
|
|
256
|
-
return `
|
|
256
|
+
return `CROSS JOIN UNNEST(COALESCE(transform(${source}, x -> ROW(x) ), ARRAY[null])) as ${alias}(value)`;
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
259
|
else if (needDistinctKey) {
|
|
260
|
-
return `
|
|
260
|
+
return `CROSS JOIN UNNEST(COALESCE(zip_with(${source}, SEQUENCE(1,cardinality(${source})), (r,__row_id) -> (r, __row_id)),ARRAY[null])) as ${alias}_outer(${alias},__row_id_from_${alias})`;
|
|
261
261
|
}
|
|
262
262
|
else {
|
|
263
|
-
return `
|
|
263
|
+
return `CROSS JOIN UNNEST(COALESCE(${source}, ARRAY[null])) as ${alias}(${fieldsNames.join(', ')})`;
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
266
|
sqlSumDistinctHashedKey(sqlDistinctKey) {
|
|
@@ -494,4 +494,15 @@ ${(0, utils_1.indent)(sql)}
|
|
|
494
494
|
}
|
|
495
495
|
}
|
|
496
496
|
exports.TrinoDialect = TrinoDialect;
|
|
497
|
+
class PrestoDialect extends TrinoDialect {
|
|
498
|
+
constructor() {
|
|
499
|
+
super(...arguments);
|
|
500
|
+
this.name = 'presto';
|
|
501
|
+
this.supportsPipelinesInViews = false; // what a drag...
|
|
502
|
+
}
|
|
503
|
+
sqlGenerateUUID() {
|
|
504
|
+
return 'CAST(UUID() AS VARCHAR)';
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
exports.PrestoDialect = PrestoDialect;
|
|
497
508
|
//# sourceMappingURL=trino.js.map
|