-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 ExtractFilterExprVisitor. #5422
Conversation
207be23
to
547e302
Compare
aa975ad
to
b603f68
Compare
remainedExpr = static_cast<LogicalExpression *>(std::move(remainedOperands[0])); | ||
} | ||
if (remainedExpr_ != nullptr) { | ||
if (remainedExprFromAnd_) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a little confused, when remainedExpr_ is not equal to null
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MATCH (v0)<-[e0]-()<-[e1]-(v1)
WHERE (id(v0) == 6)
AND ((NOT (NOT ((v1.Label_6.Label_6_5_Int > (e1.Rel_0_5_Int - 0.300177))
AND v1.Label_6.Label_6_1_Bool))))
RETURN count(*)
In this case (added in the tck), for example, the remainedExpr_
would not be equal to NULL for one time.
There are three conditions in total, forming a tree of expressions, where all index nodes are AND
logics. Or, this query could be summarized to be MATCH ... WHERE <A> AND (<B> AND <C>) return ...
.
v1.Label_6.Label_6_5_Int > (e1.Rel_0_5_Int - 0.300177)
can not be pushed down into AppendVertices. It is a leaf node in the expression tree. And, it is an remainedExpr_
, while visiting its direct father node.
id(v0) == 6
also cannot be pushed down into AppendVertices. It is also an remainedExpr_
.
Without this bug fix, v1.Label_6.Label_6_5_Int > (e1.Rel_0_5_Int - 0.300177)
as an remainedExpr_
was thrown away, leaving only id(v0) == 6
as an remainedExpr_
, because id(v0) == 6
is visited later. So, in the final query plan, there is no v1.Label_6.Label_6_5_Int > (e1.Rel_0_5_Int - 0.300177)
such condition, causing wrong results.
…at it is guarding are suppoed to work only on more than 1 operand, they can and they are, de facto, used to process expressions with only one operand.
b603f68
to
0a76751
Compare
What type of PR is this?
What problem(s) does this PR solve?
Issue(s) number:
Fix #5423
Description:
How do you solve it?
Special notes for your reviewer, ex. impact of this fix, design document, etc:
Checklist:
Tests:
Affects:
Release notes:
Please confirm whether to be reflected in release notes and how to describe: