fix: Fix missing null or non-exist key in json index (#40336)

issue: #35528

---------

Signed-off-by: sunby <sunbingyi1992@gmail.com>
This commit is contained in:
Bingyi Sun 2025-03-05 11:48:02 +08:00 committed by GitHub
parent 63a7c4570e
commit be4d09561b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -36,6 +36,8 @@ JsonInvertedIndex<T>::build_index_for_json(
auto json_column = static_cast<const Json*>(data->RawValue(i));
if (this->schema_.nullable() && !data->is_valid(i)) {
this->null_offset.push_back(i);
this->wrapper_->template add_array_data<T>(
nullptr, 0, offset++);
continue;
}
value_result<GetType> res = json_column->at<GetType>(nested_path_);
@ -45,7 +47,9 @@ JsonInvertedIndex<T>::build_index_for_json(
err == simdjson::NO_SUCH_FIELD,
"Failed to parse json, err: {}",
err);
offset++;
this->null_offset.push_back(i);
this->wrapper_->template add_array_data<T>(
nullptr, 0, offset++);
continue;
}
if constexpr (std::is_same_v<GetType, std::string_view>) {