fix: [2.6] correct loop logic for timestamptz scalar index output (#46100) (#46110)

Cherry-pick from master
pr: #46100
Related to #46098

Fix the ReverseDataFromIndex function where the assignment of raw_data
to scalar_array and the break statement were incorrectly placed inside
the for loop for TIMESTAMPTZ data type. This caused QueryNode to panic
when outputting timestamptz fields from scalar index.

Move the assignment and break statement outside the loop to match the
pattern used by other data types like VARCHAR.

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
This commit is contained in:
congqixia 2025-12-05 10:09:13 +08:00 committed by GitHub
parent 43cdfef56b
commit 58f5fdba1c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1003,10 +1003,10 @@ ReverseDataFromIndex(const index::IndexBase* index,
valid_data[i] = true;
}
raw_data[i] = raw.value();
auto obj = scalar_array->mutable_timestamptz_data();
*(obj->mutable_data()) = {raw_data.begin(), raw_data.end()};
break;
}
auto obj = scalar_array->mutable_timestamptz_data();
*(obj->mutable_data()) = {raw_data.begin(), raw_data.end()};
break;
}
case DataType::VARCHAR: {
using IndexType = index::ScalarIndex<std::string>;