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 ExtractFilterExprVisitor. #5422

Merged
merged 3 commits into from
Mar 24, 2023
Merged

Conversation

xtcyclist
Copy link
Contributor

@xtcyclist xtcyclist commented Mar 21, 2023

What type of PR is this?

  • bug
  • feature
  • enhancement

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:

  • Unit test(positive and negative cases)
  • Function test
  • Performance test
  • TCK

Affects:

  • Documentation affected (Please add the label if documentation needs to be modified.)
  • Incompatibility (If it breaks the compatibility, please describe it and add the label.)
  • If it's needed to cherry-pick (If cherry-pick to some branches is required, please label the destination version(s).)
  • Performance impacted: Consumes more CPU/Memory

Release notes:

Please confirm whether to be reflected in release notes and how to describe:

ex. Fixed the bug .....

@xtcyclist xtcyclist added the ready-for-testing PR: ready for the CI test label Mar 21, 2023
@xtcyclist xtcyclist requested a review from Shylock-Hg March 21, 2023 03:51
@xtcyclist xtcyclist force-pushed the fix_entbug_2233 branch 2 times, most recently from aa975ad to b603f68 Compare March 22, 2023 11:03
remainedExpr = static_cast<LogicalExpression *>(std::move(remainedOperands[0]));
}
if (remainedExpr_ != nullptr) {
if (remainedExprFromAnd_) {
Copy link
Contributor

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

Copy link
Contributor Author

@xtcyclist xtcyclist Mar 24, 2023

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.

@xtcyclist xtcyclist requested a review from nevermore3 March 24, 2023 07:56
…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.
@Sophie-Xie Sophie-Xie merged commit f15e381 into vesoft-inc:master Mar 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready for review ready-for-testing PR: ready for the CI test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

graph does not filter out record correctly
4 participants