fix: fix not equal not include None (#44960)

#44959

Signed-off-by: luzhang <luzhang@zilliz.com>
Co-authored-by: luzhang <luzhang@zilliz.com>
This commit is contained in:
zhagnlu 2025-10-20 18:25:52 +08:00 committed by GitHub
parent fd22dc281a
commit 26c3983d93
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -854,7 +854,9 @@ PhyUnaryRangeFilterExpr::ExecRangeVisitorImplJson(EvalCtx& context) {
offset = (offsets) ? offsets[i] : i; offset = (offsets) ? offsets[i] : i;
} }
if (valid_data != nullptr && !valid_data[offset]) { if (valid_data != nullptr && !valid_data[offset]) {
res[i] = valid_res[i] = false; // NULL values are not equal to anything
valid_res[i] = false;
res[i] = true;
continue; continue;
} }
if (has_bitmap_input && if (has_bitmap_input &&
@ -986,7 +988,11 @@ PhyUnaryRangeFilterExpr::ExecRangeVisitorImplJsonByStats() {
: std::stoi(pointerpair.second); : std::stoi(pointerpair.second);
ExprValueType val = GetValueFromProto<ExprValueType>(expr_->val_); ExprValueType val = GetValueFromProto<ExprValueType>(expr_->val_);
auto op_type = expr_->op_type_; // for NotEqual: compute Equal and flip the result
// this avoids handling NULL values differently in multiple places
auto op_type = (expr_->op_type_ == proto::plan::OpType::NotEqual)
? proto::plan::OpType::Equal
: expr_->op_type_;
auto segment = static_cast<const segcore::SegmentSealed*>(segment_); auto segment = static_cast<const segcore::SegmentSealed*>(segment_);
auto field_id = expr_->column_.field_id_; auto field_id = expr_->column_.field_id_;
@ -1259,6 +1265,10 @@ PhyUnaryRangeFilterExpr::ExecRangeVisitorImplJsonByStats() {
} }
} }
// for NotEqual: flip the result
if (expr_->op_type_ == proto::plan::OpType::NotEqual) {
cached_index_chunk_res_->flip();
}
cached_index_chunk_id_ = 0; cached_index_chunk_id_ = 0;
} }