From 4611fd7f810affc30c12878a4fc34537485a0388 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beyza=20Aydo=C4=9Fan?= Date: Thu, 4 Jan 2024 21:19:02 +0300 Subject: [PATCH] return hll_empty for no input rows in hll_add_agg --- src/hll.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/hll.c b/src/hll.c index 4e86cb6..c464a78 100644 --- a/src/hll.c +++ b/src/hll.c @@ -3608,7 +3608,11 @@ hll_pack(PG_FUNCTION_ARGS) // Is the first argument a NULL? if (PG_ARGISNULL(0)) { - PG_RETURN_NULL(); + PG_RETURN_DATUM(DirectFunctionCall4(hll_empty4, + Int32GetDatum(g_default_log2m), + Int32GetDatum(g_default_regwidth), + Int64GetDatum(g_default_expthresh), + Int32GetDatum(g_default_sparseon))); } else { @@ -3635,7 +3639,7 @@ hll_pack(PG_FUNCTION_ARGS) PG_RETURN_BYTEA_P(cb); } - } + } } // Final function, computes cardinality of unpacked bytea.