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

fix: disable use_index when some array expr #34894

Merged
merged 1 commit into from
Jul 28, 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
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,12 @@ PhyBinaryArithOpEvalRangeExpr::Eval(EvalCtx& context, VectorPtr& result) {
auto value_type = expr_->value_.val_case();
switch (value_type) {
case proto::plan::GenericValue::ValCase::kInt64Val: {
SetNotUseIndex();
result = ExecRangeVisitorImplForArray<int64_t>();
break;
}
case proto::plan::GenericValue::ValCase::kFloatVal: {
SetNotUseIndex();
result = ExecRangeVisitorImplForArray<double>();
break;
}
Expand Down
3 changes: 3 additions & 0 deletions internal/core/src/exec/expression/BinaryRangeExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,17 @@ PhyBinaryRangeFilterExpr::Eval(EvalCtx& context, VectorPtr& result) {
auto value_type = expr_->lower_val_.val_case();
switch (value_type) {
case proto::plan::GenericValue::ValCase::kInt64Val: {
SetNotUseIndex();
result = ExecRangeVisitorImplForArray<int64_t>();
break;
}
case proto::plan::GenericValue::ValCase::kFloatVal: {
SetNotUseIndex();
result = ExecRangeVisitorImplForArray<double>();
break;
}
case proto::plan::GenericValue::ValCase::kStringVal: {
SetNotUseIndex();
result = ExecRangeVisitorImplForArray<std::string>();
break;
}
Expand Down
5 changes: 5 additions & 0 deletions internal/core/src/exec/expression/Expr.h
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,11 @@ class SegmentExpr : public Expr {
return true;
}

void
SetNotUseIndex() {
use_index_ = false;
}

protected:
const segcore::SegmentInternalInterface* segment_;
const FieldId field_id_;
Expand Down
5 changes: 5 additions & 0 deletions internal/core/src/exec/expression/TermExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,21 +91,26 @@ PhyTermFilterExpr::Eval(EvalCtx& context, VectorPtr& result) {
}
case DataType::ARRAY: {
if (expr_->vals_.size() == 0) {
SetNotUseIndex();
result = ExecVisitorImplTemplateArray<bool>();
break;
}
auto type = expr_->vals_[0].val_case();
switch (type) {
case proto::plan::GenericValue::ValCase::kBoolVal:
SetNotUseIndex();
result = ExecVisitorImplTemplateArray<bool>();
break;
case proto::plan::GenericValue::ValCase::kInt64Val:
SetNotUseIndex();
result = ExecVisitorImplTemplateArray<int64_t>();
break;
case proto::plan::GenericValue::ValCase::kFloatVal:
SetNotUseIndex();
result = ExecVisitorImplTemplateArray<double>();
break;
case proto::plan::GenericValue::ValCase::kStringVal:
SetNotUseIndex();
result = ExecVisitorImplTemplateArray<std::string>();
break;
default:
Expand Down
4 changes: 4 additions & 0 deletions internal/core/src/exec/expression/UnaryExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,15 +212,19 @@ PhyUnaryRangeFilterExpr::Eval(EvalCtx& context, VectorPtr& result) {
auto val_type = expr_->val_.val_case();
switch (val_type) {
case proto::plan::GenericValue::ValCase::kBoolVal:
SetNotUseIndex();
result = ExecRangeVisitorImplArray<bool>();
break;
case proto::plan::GenericValue::ValCase::kInt64Val:
SetNotUseIndex();
result = ExecRangeVisitorImplArray<int64_t>();
break;
case proto::plan::GenericValue::ValCase::kFloatVal:
SetNotUseIndex();
result = ExecRangeVisitorImplArray<double>();
break;
case proto::plan::GenericValue::ValCase::kStringVal:
SetNotUseIndex();
result = ExecRangeVisitorImplArray<std::string>();
break;
case proto::plan::GenericValue::ValCase::kArrayVal:
Expand Down
Loading