@@ -10,8 +10,12 @@ import {
10
10
DefinitionBlueprint ,
11
11
DefinitionBlueprintMap ,
12
12
OverloadedDefinitionBlueprint ,
13
+ TypeDescBlueprint ,
13
14
} from '../functions/util' ;
14
15
16
+ // Cute shortcut So you can write things like: {array: T} and {dimension: T}
17
+ const T : TypeDescBlueprint = { generic : 'T' } ;
18
+
15
19
const date_from_unix_date : DefinitionBlueprint = {
16
20
takes : { 'unix_date' : 'number' } ,
17
21
returns : 'date' ,
@@ -69,6 +73,38 @@ export const STANDARDSQL_DIALECT_FUNCTIONS: DefinitionBlueprintMap = {
69
73
date_from_unix_date,
70
74
string_agg,
71
75
string_agg_distinct,
76
+ hll_accumulate : {
77
+ default : {
78
+ takes : { 'value' : { dimension : T } } ,
79
+ returns : { measure : { sql_native : 'bytes' } } ,
80
+ generic : {
81
+ 'T' : [ 'string' , 'number' ] ,
82
+ } ,
83
+ isSymmetric : true ,
84
+ impl : { function : 'HLL_COUNT.INIT' } ,
85
+ } ,
86
+ } ,
87
+ hll_combine : {
88
+ takes : { 'value' : { sql_native : 'bytes' } } ,
89
+ returns : { measure : { sql_native : 'bytes' } } ,
90
+ impl : { function : 'HLL_COUNT.MERGE_PARTIAL' } ,
91
+ isSymmetric : true ,
92
+ } ,
93
+ hll_estimate : {
94
+ takes : { 'value' : { sql_native : 'bytes' } } ,
95
+ returns : { dimension : 'number' } ,
96
+ impl : { function : 'HLL_COUNT.EXTRACT' } ,
97
+ } ,
98
+ hll_export : {
99
+ takes : { 'value' : { sql_native : 'bytes' } } ,
100
+ returns : { dimension : { sql_native : 'bytes' } } ,
101
+ impl : { sql : 'CAST(${value} AS BYTES)' } ,
102
+ } ,
103
+ hll_import : {
104
+ takes : { 'value' : { sql_native : 'bytes' } } ,
105
+ returns : { dimension : { sql_native : 'bytes' } } ,
106
+ impl : { sql : 'CAST(${value} AS BYTES)' } ,
107
+ } ,
72
108
...def ( 'repeat' , { 'str' : 'string' , 'n' : 'number' } , 'string' ) ,
73
109
...def ( 'reverse' , { 'str' : 'string' } , 'string' ) ,
74
110
} ;
0 commit comments