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

Skip redudant self-reflective edges in GetNeighborsNode #4943

Merged

Conversation

xtcyclist
Copy link
Contributor

What type of PR is this?

  • bug
  • feature
  • enhancement

What problem(s) does this PR solve?

Issue(s) number:

Close #4929

Description:

Duplicated results in matches.

Reason:

  • Self-reflective edges like (v0)-[e]->(v0) are stored as two different versions in the storage: the outbound one and the inbound one.
  • When fetching edges of both directions in the GetNeighborsNode, these two physical versions are treated as two distinct edges, although they are the same edge.
  • Such redudant edges returned from the storage cause the query engine's traverse operator to process redudant edges, resulting in extra overhead and wrong results.

How do you solve it?

In the GetNeighborsNode, if an edge fetched from the storage has identical srcID and dstID, check whether it has been visited previously. If so, skip 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
  • N/A

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 force-pushed the fix_duplicate_self_reflective_edges branch from 82a74a5 to 641f385 Compare November 29, 2022 03:20
@xtcyclist xtcyclist changed the title Skip redudant self-reflective edges in GetNeighborsNode Skip redudant self-reflective edges in HashJoinNode Nov 29, 2022
@xtcyclist xtcyclist marked this pull request as draft November 29, 2022 04:57
@xtcyclist xtcyclist force-pushed the fix_duplicate_self_reflective_edges branch from c9f6d45 to 1a4d051 Compare November 29, 2022 05:35
@xtcyclist xtcyclist changed the title Skip redudant self-reflective edges in HashJoinNode Skip redudant self-reflective edges in GetNeighborsNode Nov 29, 2022
@xtcyclist xtcyclist added the ready-for-testing PR: ready for the CI test label Nov 29, 2022
@xtcyclist xtcyclist force-pushed the fix_duplicate_self_reflective_edges branch from b313331 to dac9610 Compare November 29, 2022 05:57
@xtcyclist xtcyclist marked this pull request as ready for review November 29, 2022 05:57
@xtcyclist xtcyclist force-pushed the fix_duplicate_self_reflective_edges branch from eb915a8 to 994f428 Compare November 29, 2022 13:13
Copy link
Contributor

@critical27 critical27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job~ I have some other question, see the issue please.

src/storage/exec/GetNeighborsNode.h Outdated Show resolved Hide resolved
@xtcyclist xtcyclist force-pushed the fix_duplicate_self_reflective_edges branch 2 times, most recently from dd7f12a to e02b240 Compare November 30, 2022 06:52
yixinglu
yixinglu previously approved these changes Nov 30, 2022
@xtcyclist xtcyclist force-pushed the fix_duplicate_self_reflective_edges branch from e02b240 to 78fcf96 Compare November 30, 2022 09:42
yixinglu
yixinglu previously approved these changes Dec 1, 2022
@codecov-commenter
Copy link

Codecov Report

Base: 76.83% // Head: 76.84% // Increases project coverage by +0.01% 🎉

Coverage data is based on head (48b6223) compared to base (7083d72).
Patch coverage: 89.47% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4943      +/-   ##
==========================================
+ Coverage   76.83%   76.84%   +0.01%     
==========================================
  Files        1101     1101              
  Lines       81222    81245      +23     
==========================================
+ Hits        62404    62435      +31     
+ Misses      18818    18810       -8     
Impacted Files Coverage Δ
src/clients/meta/MetaClient.h 92.30% <ø> (ø)
src/graph/executor/query/TraverseExecutor.h 100.00% <ø> (ø)
src/storage/CommonUtils.h 98.27% <ø> (ø)
src/storage/exec/QueryUtils.h 90.90% <ø> (ø)
src/storage/CommonUtils.cpp 91.17% <60.00%> (-5.60%) ⬇️
src/storage/exec/GetNeighborsNode.h 94.54% <100.00%> (+0.79%) ⬆️
src/graph/context/Result.cpp 70.00% <0.00%> (-10.00%) ⬇️
src/graph/planner/Planner.cpp 75.00% <0.00%> (-5.00%) ⬇️
src/graph/executor/query/ProjectExecutor.cpp 62.16% <0.00%> (-2.71%) ⬇️
src/common/expression/UnaryExpression.cpp 83.69% <0.00%> (-2.18%) ⬇️
... and 34 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@xtcyclist xtcyclist force-pushed the fix_duplicate_self_reflective_edges branch from 48b6223 to 0c491f0 Compare December 1, 2022 15:52
@xtcyclist xtcyclist force-pushed the fix_duplicate_self_reflective_edges branch from 0c491f0 to d846675 Compare December 2, 2022 02:18
@xtcyclist xtcyclist requested a review from yixinglu December 2, 2022 02:19
yixinglu
yixinglu previously approved these changes Dec 2, 2022
@xtcyclist xtcyclist force-pushed the fix_duplicate_self_reflective_edges branch from d846675 to 3c2e911 Compare December 2, 2022 07:06
@xtcyclist xtcyclist force-pushed the fix_duplicate_self_reflective_edges branch from 3c2e911 to 406ff01 Compare December 5, 2022 07:01
@xtcyclist xtcyclist force-pushed the fix_duplicate_self_reflective_edges branch from 406ff01 to 32b291f Compare December 5, 2022 09:16
@yixinglu yixinglu merged commit 81feb43 into vesoft-inc:master Dec 6, 2022
@xtcyclist xtcyclist deleted the fix_duplicate_self_reflective_edges branch December 6, 2022 02:20
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 return duplicate result
5 participants