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 authored and Sophie-Xie committed Apr 19, 2023
1 parent 214e6ee commit ae3c5d2
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 ae3c5d2

Please sign in to comment.