@malloydata/malloy 0.0.223-dev241216191808 → 0.0.223-dev241217155138
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.js
CHANGED
|
@@ -82,6 +82,7 @@ class Dialect {
|
|
|
82
82
|
// can LEFT JOIN UNNEST
|
|
83
83
|
this.supportsLeftJoinUnnest = true;
|
|
84
84
|
this.supportsCountApprox = false;
|
|
85
|
+
this.supportsHyperLogLog = false;
|
|
85
86
|
// MYSQL doesn't have full join, maybe others.
|
|
86
87
|
this.supportsFullJoin = true;
|
|
87
88
|
this.nativeBoolean = true;
|
|
@@ -63,6 +63,63 @@ const count_approx = {
|
|
|
63
63
|
impl: { function: 'APPROX_DISTINCT' },
|
|
64
64
|
isSymmetric: true,
|
|
65
65
|
};
|
|
66
|
+
const hll_accumulate = {
|
|
67
|
+
default: {
|
|
68
|
+
generic: {
|
|
69
|
+
'T': ['string', 'number', 'date', 'timestamp', 'boolean', 'json'],
|
|
70
|
+
},
|
|
71
|
+
takes: { 'value': { dimension: { generic: 'T' } } },
|
|
72
|
+
returns: { measure: 'string' },
|
|
73
|
+
isSymmetric: true,
|
|
74
|
+
impl: {
|
|
75
|
+
function: 'APPROX_SET',
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
with_percent: {
|
|
79
|
+
generic: {
|
|
80
|
+
'T': ['string', 'number', 'date', 'timestamp', 'boolean', 'json'],
|
|
81
|
+
},
|
|
82
|
+
takes: { 'value': { dimension: { generic: 'T' } }, 'accuracy': 'number' },
|
|
83
|
+
returns: { measure: 'string' },
|
|
84
|
+
isSymmetric: true,
|
|
85
|
+
impl: {
|
|
86
|
+
function: 'APPROX_SET',
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
const hll_combine = {
|
|
91
|
+
takes: {
|
|
92
|
+
'value': 'string',
|
|
93
|
+
},
|
|
94
|
+
returns: { measure: 'string' },
|
|
95
|
+
impl: { function: 'MERGE' },
|
|
96
|
+
isSymmetric: true,
|
|
97
|
+
};
|
|
98
|
+
const hll_estimate = {
|
|
99
|
+
takes: {
|
|
100
|
+
'value': 'string',
|
|
101
|
+
},
|
|
102
|
+
returns: { dimension: 'number' },
|
|
103
|
+
impl: { function: 'CARDINALITY' },
|
|
104
|
+
};
|
|
105
|
+
const hll_export = {
|
|
106
|
+
takes: {
|
|
107
|
+
'value': 'string',
|
|
108
|
+
},
|
|
109
|
+
returns: { dimension: 'string' },
|
|
110
|
+
impl: {
|
|
111
|
+
sql: 'CAST(${value} AS VARBINARY)',
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
const hll_import = {
|
|
115
|
+
takes: {
|
|
116
|
+
'value': 'string',
|
|
117
|
+
},
|
|
118
|
+
returns: { dimension: 'string' },
|
|
119
|
+
impl: {
|
|
120
|
+
sql: 'CAST(${value} AS HyperLogLog)',
|
|
121
|
+
},
|
|
122
|
+
};
|
|
66
123
|
const max_by = {
|
|
67
124
|
generic: { 'T': ['string', 'number', 'date', 'timestamp', 'boolean', 'json'] },
|
|
68
125
|
takes: {
|
|
@@ -255,6 +312,8 @@ exports.TRINO_DIALECT_FUNCTIONS = {
|
|
|
255
312
|
bool_or,
|
|
256
313
|
corr,
|
|
257
314
|
count_approx,
|
|
315
|
+
hll_accumulate,
|
|
316
|
+
hll_combine,
|
|
258
317
|
max_by,
|
|
259
318
|
min_by,
|
|
260
319
|
string_agg,
|
|
@@ -266,6 +325,9 @@ exports.TRINO_DIALECT_FUNCTIONS = {
|
|
|
266
325
|
date_format,
|
|
267
326
|
date_parse,
|
|
268
327
|
from_unixtime,
|
|
328
|
+
hll_estimate,
|
|
329
|
+
hll_export,
|
|
330
|
+
hll_import,
|
|
269
331
|
json_extract_scalar,
|
|
270
332
|
regexp_like,
|
|
271
333
|
regexp_replace,
|
|
@@ -29,6 +29,7 @@ export declare class TrinoDialect extends PostgresBase {
|
|
|
29
29
|
supportsComplexFilteredSources: boolean;
|
|
30
30
|
supportsTempTables: boolean;
|
|
31
31
|
supportsCountApprox: boolean;
|
|
32
|
+
supportsHyperLogLog: boolean;
|
|
32
33
|
quoteTablePath(tablePath: string): string;
|
|
33
34
|
sqlGroupSetTable(groupSetCount: number): string;
|
|
34
35
|
exprToSQL(qi: QueryInfo, df: Expr): string | undefined;
|
|
@@ -109,6 +109,7 @@ class TrinoDialect extends pg_impl_1.PostgresBase {
|
|
|
109
109
|
this.supportsComplexFilteredSources = false;
|
|
110
110
|
this.supportsTempTables = false;
|
|
111
111
|
this.supportsCountApprox = true;
|
|
112
|
+
this.supportsHyperLogLog = true;
|
|
112
113
|
// TODO(figutierrez): update.
|
|
113
114
|
this.keywords = `
|
|
114
115
|
ALL
|