@malloydata/malloy 0.0.225-dev241221012915 → 0.0.225-dev241223203704
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.
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.STANDARDSQL_DIALECT_FUNCTIONS = void 0;
|
|
10
10
|
const util_1 = require("../functions/util");
|
|
11
|
+
// Cute shortcut So you can write things like: {array: T} and {dimension: T}
|
|
12
|
+
const T = { generic: 'T' };
|
|
11
13
|
const date_from_unix_date = {
|
|
12
14
|
takes: { 'unix_date': 'number' },
|
|
13
15
|
returns: 'date',
|
|
@@ -62,6 +64,38 @@ exports.STANDARDSQL_DIALECT_FUNCTIONS = {
|
|
|
62
64
|
date_from_unix_date,
|
|
63
65
|
string_agg,
|
|
64
66
|
string_agg_distinct,
|
|
67
|
+
hll_accumulate: {
|
|
68
|
+
default: {
|
|
69
|
+
takes: { 'value': { dimension: T } },
|
|
70
|
+
returns: { measure: { sql_native: 'bytes' } },
|
|
71
|
+
generic: {
|
|
72
|
+
'T': ['string', 'number'],
|
|
73
|
+
},
|
|
74
|
+
isSymmetric: true,
|
|
75
|
+
impl: { function: 'HLL_COUNT.INIT' },
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
hll_combine: {
|
|
79
|
+
takes: { 'value': { sql_native: 'bytes' } },
|
|
80
|
+
returns: { measure: { sql_native: 'bytes' } },
|
|
81
|
+
impl: { function: 'HLL_COUNT.MERGE_PARTIAL' },
|
|
82
|
+
isSymmetric: true,
|
|
83
|
+
},
|
|
84
|
+
hll_estimate: {
|
|
85
|
+
takes: { 'value': { sql_native: 'bytes' } },
|
|
86
|
+
returns: { dimension: 'number' },
|
|
87
|
+
impl: { function: 'HLL_COUNT.EXTRACT' },
|
|
88
|
+
},
|
|
89
|
+
hll_export: {
|
|
90
|
+
takes: { 'value': { sql_native: 'bytes' } },
|
|
91
|
+
returns: { dimension: { sql_native: 'bytes' } },
|
|
92
|
+
impl: { sql: 'CAST(${value} AS BYTES)' },
|
|
93
|
+
},
|
|
94
|
+
hll_import: {
|
|
95
|
+
takes: { 'value': { sql_native: 'bytes' } },
|
|
96
|
+
returns: { dimension: { sql_native: 'bytes' } },
|
|
97
|
+
impl: { sql: 'CAST(${value} AS BYTES)' },
|
|
98
|
+
},
|
|
65
99
|
...(0, util_1.def)('repeat', { 'str': 'string', 'n': 'number' }, 'string'),
|
|
66
100
|
...(0, util_1.def)('reverse', { 'str': 'string' }, 'string'),
|
|
67
101
|
};
|
|
@@ -24,6 +24,7 @@ export declare class StandardSQLDialect extends Dialect {
|
|
|
24
24
|
cantPartitionWindowFunctionsOnExpressions: boolean;
|
|
25
25
|
hasModOperator: boolean;
|
|
26
26
|
nestedArrays: boolean;
|
|
27
|
+
supportsHyperLogLog: boolean;
|
|
27
28
|
quoteTablePath(tablePath: string): string;
|
|
28
29
|
sqlGroupSetTable(groupSetCount: number): string;
|
|
29
30
|
sqlAnyValue(groupSet: number, fieldName: string): string;
|
|
@@ -98,6 +98,7 @@ class StandardSQLDialect extends dialect_1.Dialect {
|
|
|
98
98
|
this.cantPartitionWindowFunctionsOnExpressions = true;
|
|
99
99
|
this.hasModOperator = false;
|
|
100
100
|
this.nestedArrays = false; // Can't have an array of arrays for some reason
|
|
101
|
+
this.supportsHyperLogLog = true;
|
|
101
102
|
}
|
|
102
103
|
quoteTablePath(tablePath) {
|
|
103
104
|
return `\`${tablePath}\``;
|