Skip to content

Commit be85ac6

Browse files
authored
feat: Postgres Citus Data HLL plugin implementation (#601) Thanks to @milanbella !
* pg_approx_hll * pg_approx_hll * pg_approx_hll Co-authored-by: milan.bella@ibm.com <milan.bella@ibm.com> Fixes #563
1 parent 6fbd703 commit be85ac6

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

packages/cubejs-schema-compiler/adapter/PostgresQuery.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,18 @@ class PostgresQuery extends BaseQuery {
2929
timeGroupedColumn(granularity, dimension) {
3030
return `date_trunc('${GRANULARITY_TO_INTERVAL[granularity]}', ${dimension})`;
3131
}
32+
33+
hllInit(sql) {
34+
return `hll_add_agg(hll_hash_any(${sql}))`;
35+
}
36+
37+
hllMerge(sql) {
38+
return `hll_cardinality(hll_union_agg(${sql}))`;
39+
}
40+
41+
countDistinctApprox(sql) {
42+
return `hll_cardinality(hll_add_agg(hll_hash_any(${sql})))`;
43+
}
3244
}
3345

3446
module.exports = PostgresQuery;

0 commit comments

Comments
 (0)