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

Stop the pushing down of not expressions that are not rewritten to pr… #5502

Merged
merged 1 commit into from
Apr 14, 2023
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
15 changes: 15 additions & 0 deletions src/graph/visitor/ExtractFilterExprVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,21 @@ void ExtractFilterExprVisitor::visit(ColumnExpression *) {
canBePushed_ = false;
}

void ExtractFilterExprVisitor::visit(UnaryExpression *expr) {
if (expr->kind() == Expression::Kind::kUnaryNot &&
(expr->operand()->kind() == Expression::Kind::kLogicalAnd ||
expr->operand()->kind() == Expression::Kind::kLogicalOr)) {
// The NOT operation in this kind of expressions should had been reduced.
// In case it had not been reduced, pushing it down would cause wrong results.
canBePushed_ = false;
return;
}
if (expr->operand() != nullptr) {
expr->operand()->accept(this);
return;
}
}

// @return: whether this logical expr satisfies split condition
bool ExtractFilterExprVisitor::visitLogicalAnd(LogicalExpression *expr, std::vector<bool> &flags) {
DCHECK_EQ(expr->kind(), Expression::Kind::kLogicalAnd);
Expand Down
1 change: 1 addition & 0 deletions src/graph/visitor/ExtractFilterExprVisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class ExtractFilterExprVisitor final : public ExprVisitorImpl {
void visit(LogicalExpression *) override;
void visit(ColumnExpression *) override;
void visit(SubscriptRangeExpression *) override;
void visit(UnaryExpression *) override;

private:
enum class PushType {
Expand Down