Skip to content

Commit

Permalink
stop the pushing down of not expressions that are not rewritten to pr…
Browse files Browse the repository at this point in the history
…oper forms. (#5502)
  • Loading branch information
xtcyclist committed Apr 14, 2023
1 parent f79c3b8 commit 17de17d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
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

0 comments on commit 17de17d

Please sign in to comment.