From be4d09561b9119571581cc202145b6129d995d19 Mon Sep 17 00:00:00 2001 From: Bingyi Sun Date: Wed, 5 Mar 2025 11:48:02 +0800 Subject: [PATCH] fix: Fix missing null or non-exist key in json index (#40336) issue: #35528 --------- Signed-off-by: sunby --- internal/core/src/index/JsonInvertedIndex.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/core/src/index/JsonInvertedIndex.cpp b/internal/core/src/index/JsonInvertedIndex.cpp index d02a92c8f6..00f09d5aed 100644 --- a/internal/core/src/index/JsonInvertedIndex.cpp +++ b/internal/core/src/index/JsonInvertedIndex.cpp @@ -36,6 +36,8 @@ JsonInvertedIndex::build_index_for_json( auto json_column = static_cast(data->RawValue(i)); if (this->schema_.nullable() && !data->is_valid(i)) { this->null_offset.push_back(i); + this->wrapper_->template add_array_data( + nullptr, 0, offset++); continue; } value_result res = json_column->at(nested_path_); @@ -45,7 +47,9 @@ JsonInvertedIndex::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( + nullptr, 0, offset++); continue; } if constexpr (std::is_same_v) {