diff --git a/be/src/vec/functions/function_string.h b/be/src/vec/functions/function_string.h index 79b5205640a74d..0a4b3432015ccc 100644 --- a/be/src/vec/functions/function_string.h +++ b/be/src/vec/functions/function_string.h @@ -3243,7 +3243,7 @@ class FunctionIntToChar : public IFunction { void integer_to_char_(int line_num, const int* num, ColumnString::Chars& chars, IColumn::Offsets& offsets) const { if (0 == *num) { - chars.push_back(' '); + chars.push_back('\0'); offsets[line_num] = offsets[line_num - 1] + 1; return; } @@ -3257,7 +3257,7 @@ class FunctionIntToChar : public IFunction { } offsets[line_num] = offsets[line_num - 1] + k + 1; for (; k >= 0; --k) { - chars.push_back(bytes[k] ? bytes[k] : ' '); + chars.push_back(bytes[k] ? bytes[k] : '\0'); } #else int k = 0; @@ -3268,7 +3268,7 @@ class FunctionIntToChar : public IFunction { } offsets[line_num] = offsets[line_num - 1] + 4 - k; for (; k < 4; ++k) { - chars.push_back(bytes[k] ? bytes[k] : ' '); + chars.push_back(bytes[k] ? bytes[k] : '\0'); } #endif } diff --git a/regression-test/data/query_p0/sql_functions/string_functions/test_string_function.out b/regression-test/data/query_p0/sql_functions/string_functions/test_string_function.out index b51fb32d6150ec..118c58c491081b 100644 Binary files a/regression-test/data/query_p0/sql_functions/string_functions/test_string_function.out and b/regression-test/data/query_p0/sql_functions/string_functions/test_string_function.out differ diff --git a/regression-test/suites/query_p0/sql_functions/string_functions/test_string_function.groovy b/regression-test/suites/query_p0/sql_functions/string_functions/test_string_function.groovy index 4f9faac47f93a7..cee30808b84de8 100644 --- a/regression-test/suites/query_p0/sql_functions/string_functions/test_string_function.groovy +++ b/regression-test/suites/query_p0/sql_functions/string_functions/test_string_function.groovy @@ -280,5 +280,7 @@ suite("test_string_function", "arrow_flight_sql") { qt_sql_func_char6 """ select char(k1) from test_function_char order by k1; """ qt_sql_func_char7 """ select char(k1, k2, k3, k4) from test_function_char order by k1, k2, k3, k4; """ qt_sql_func_char8 """ select char(k1, k2, k3, k4, 65) from test_function_char order by k1, k2, k3, k4; """ + qt_sql_func_char9 """ select char(0) = ' '; """ + qt_sql_func_char10 """ select char(0) = '\0'; """ }