@malloydata/malloy 0.0.225-dev250102225314 → 0.0.225-dev250103194727
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.SNOWFLAKE_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 order_by = {
|
|
12
14
|
node: 'aggregate_order_by',
|
|
13
15
|
prefix: ' WITHIN GROUP(',
|
|
@@ -53,6 +55,38 @@ const string_agg_distinct = {
|
|
|
53
55
|
exports.SNOWFLAKE_DIALECT_FUNCTIONS = {
|
|
54
56
|
string_agg,
|
|
55
57
|
string_agg_distinct,
|
|
58
|
+
hll_accumulate: {
|
|
59
|
+
default: {
|
|
60
|
+
takes: { 'value': { dimension: T } },
|
|
61
|
+
returns: { measure: { sql_native: 'hyperloglog' } },
|
|
62
|
+
generic: {
|
|
63
|
+
'T': ['string', 'number'],
|
|
64
|
+
},
|
|
65
|
+
isSymmetric: true,
|
|
66
|
+
impl: { function: 'hll_accumulate' },
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
hll_combine: {
|
|
70
|
+
takes: { 'value': { sql_native: 'hyperloglog' } },
|
|
71
|
+
returns: { measure: { sql_native: 'hyperloglog' } },
|
|
72
|
+
impl: { function: 'hll_combine' },
|
|
73
|
+
isSymmetric: true,
|
|
74
|
+
},
|
|
75
|
+
hll_estimate: {
|
|
76
|
+
takes: { 'value': { sql_native: 'hyperloglog' } },
|
|
77
|
+
returns: { dimension: 'number' },
|
|
78
|
+
impl: { function: 'hll_estimate' },
|
|
79
|
+
},
|
|
80
|
+
hll_export: {
|
|
81
|
+
takes: { 'value': { sql_native: 'hyperloglog' } },
|
|
82
|
+
returns: { dimension: { sql_native: 'bytes' } },
|
|
83
|
+
impl: { function: 'hll_export' },
|
|
84
|
+
},
|
|
85
|
+
hll_import: {
|
|
86
|
+
takes: { 'value': { sql_native: 'bytes' } },
|
|
87
|
+
returns: { dimension: { sql_native: 'hyperloglog' } },
|
|
88
|
+
impl: { function: 'hll_import' },
|
|
89
|
+
},
|
|
56
90
|
...(0, util_1.def)('repeat', { 'str': 'string', 'n': 'number' }, 'string'),
|
|
57
91
|
...(0, util_1.def)('reverse', { 'str': 'string' }, 'string'),
|
|
58
92
|
};
|
|
@@ -87,6 +87,7 @@ class SnowflakeDialect extends dialect_1.Dialect {
|
|
|
87
87
|
this.supportsSafeCast = true;
|
|
88
88
|
this.supportsNesting = true;
|
|
89
89
|
this.defaultSampling = { rows: 50000 };
|
|
90
|
+
this.supportsHyperLogLog = true;
|
|
90
91
|
// NOTE: safely setting all these to false for now
|
|
91
92
|
// more many be implemented in future
|
|
92
93
|
this.unnestWithNumbers = false;
|