From b62b3108641cc5cd03dd439115dbc798cd7d6c60 Mon Sep 17 00:00:00 2001 From: Dayue Gao Date: Sat, 9 May 2020 11:01:48 +0800 Subject: [PATCH] [Bug] Fix BE crash when input to hll_merge is null (#3521) --- be/src/exprs/hll_function.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/be/src/exprs/hll_function.cpp b/be/src/exprs/hll_function.cpp index e18f177429..849cf691e2 100644 --- a/be/src/exprs/hll_function.cpp +++ b/be/src/exprs/hll_function.cpp @@ -64,6 +64,9 @@ void HllFunctions::hll_update(FunctionContext *, const T &src, StringVal* dst) { } void HllFunctions::hll_merge(FunctionContext*, const StringVal& src, StringVal* dst) { + if (src.is_null) { + return; + } auto* dst_hll = reinterpret_cast(dst->ptr); // zero size means the src input is a agg object if (src.len == 0) { @@ -81,6 +84,9 @@ BigIntVal HllFunctions::hll_finalize(FunctionContext*, const StringVal &src) { } BigIntVal HllFunctions::hll_get_value(FunctionContext*, const StringVal &src) { + if (src.is_null) { + return BigIntVal::null(); + } auto* src_hll = reinterpret_cast(src.ptr); BigIntVal result(src_hll->estimate_cardinality()); return result;