From 9f1125dd0ee355d07aa38ffb3fec6fb2a6d2f391 Mon Sep 17 00:00:00 2001 From: Mryange Date: Thu, 18 Dec 2025 15:32:15 +0800 Subject: [PATCH] [fix](core) fix core if hll_from_base64 input invalid (#59106) ``` mysql> SELECT hll_from_base64(CAST('AgAAAAAAAABwAAAAAAAAAA==' AS VARCHAR(100))) AS result; ERROR 1105 (HY000): RpcException, msg: send fragments failed. io.grpc.StatusRuntimeException: UNAVAILABLE: io exception, host: 127.0.0.1 ``` now ``` mysql> SELECT hll_from_base64(CAST('AgAAAAAAAABwAAAAAAAAAA==' AS VARCHAR(100))) AS result; ERROR 1105 (HY000): errCode = 2, detailMessage = (127.0.0.1)[RUNTIME_ERROR]hll_from_base64 decode failed: base64: AgAAAAAAAABwAAAAAAAAAA== ``` --- be/src/vec/functions/function_hll.cpp | 3 ++- .../sql_functions/hll_functions/test_hll_functions.groovy | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/be/src/vec/functions/function_hll.cpp b/be/src/vec/functions/function_hll.cpp index a8b827c7475e97..31ad9584b04817 100644 --- a/be/src/vec/functions/function_hll.cpp +++ b/be/src/vec/functions/function_hll.cpp @@ -197,7 +197,8 @@ class FunctionHllFromBase64 : public IFunction { doris::HyperLogLog hll; if (!hll.deserialize(decoded_slice)) { return Status::RuntimeError( - fmt::format("hll_from_base64 decode failed: base64: {}", src_str)); + fmt::format("hll_from_base64 decode failed: base64: {}", + StringRef(src_str, src_size).to_string())); } else { res.emplace_back(std::move(hll)); } diff --git a/regression-test/suites/query_p0/sql_functions/hll_functions/test_hll_functions.groovy b/regression-test/suites/query_p0/sql_functions/hll_functions/test_hll_functions.groovy index 43afed6f52a7ac..aac99c29bd9730 100644 --- a/regression-test/suites/query_p0/sql_functions/hll_functions/test_hll_functions.groovy +++ b/regression-test/suites/query_p0/sql_functions/hll_functions/test_hll_functions.groovy @@ -69,4 +69,9 @@ suite("test_hll_functions") { qt_const_select "select hll_to_base64(hll_empty());" qt_const_select "select hll_to_base64(hll_hash('abc'));" qt_const_select "select hll_to_base64(hll_hash(''));" + + test { + sql """SELECT hll_from_base64(CAST('AgAAAAAAAABwAAAAAAAAAA==' AS VARCHAR(100))) AS result;""" + exception "[RUNTIME_ERROR]hll_from_base64 decode failed"; + } }