Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

branch-2.1: [Bug](function)fix json_object function check null nums error as return bool #44321 #44381

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions be/src/vec/functions/function_json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -784,13 +784,13 @@ class FunctionJsonAlwaysNotNullable : public IFunction {
for (int i = 0; i < args; i += 2) {
const auto* null_map = nullmaps[i];
if (null_map) {
const bool not_null_num =
auto not_null_num =
simd::count_zero_num((int8_t*)null_map->get_data().data(), size);
if (not_null_num < size) {
return Status::InternalError(
"function {} can not input null value , JSON documents may not contain "
"NULL member names.",
name);
"NULL member names. input size is {}:{}",
name, size, not_null_num);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@
{"k0":4,"k1":null,"k2":null,"k3":"test","k4":"2022-01-01 11:11:11","k5":null,"k6":"k6"}
{"k0":5,"k1":1,"k2":true,"k3":"test","k4":"2022-01-01 11:11:11","k5":null,"k6":"k6"}

-- !sql2 --
{"k0":"k00"}
{"k1":"k11"}

Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,7 @@ suite("test_query_json_object", "query") {
sql """select k0,json_object(k3,123) from ${tableName} order by k0;"""
exception "function json_object can not input null value , JSON documents may not contain NULL member names."
}

qt_sql2 """select json_object ( CONCAT('k',t.number%30926%3000 + 0),CONCAT('k',t.number%30926%3000 + 0,t.number%1000000) ) from numbers("number" = "2") t order by 1;"""
sql "DROP TABLE ${tableName};"
}
Loading