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 the == operator of Path #5444

Merged
merged 2 commits into from
Mar 28, 2023
Merged

Conversation

xtcyclist
Copy link
Contributor

@xtcyclist xtcyclist commented Mar 28, 2023

What type of PR is this?

  • bug
  • feature
  • enhancement

What problem(s) does this PR solve?

Issue(s) number:

Fix #5187

Description:

The same self-reflective step with +/- edge types were treated as different steps.

How do you solve it?

Consider them as equal.

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 .....

@@ -79,8 +79,8 @@ struct Step {
}

bool operator==(const Step& rhs) const {
return dst == rhs.dst && type == rhs.type && name == rhs.name && ranking == rhs.ranking &&
props == rhs.props;
return dst == rhs.dst && (type == rhs.type || type == -rhs.type) && name == rhs.name &&
Copy link
Contributor

Choose a reason for hiding this comment

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

Need to fix operator< too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK. Fixed.

@@ -79,8 +79,8 @@ struct Step {
}

bool operator==(const Step& rhs) const {
return dst == rhs.dst && type == rhs.type && name == rhs.name && ranking == rhs.ranking &&
props == rhs.props;
return dst == rhs.dst && (type == rhs.type || type == -rhs.type) && name == rhs.name &&
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we compare dst == src when type is negative?

Copy link
Contributor Author

@xtcyclist xtcyclist Mar 28, 2023

Choose a reason for hiding this comment

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

I think it's not needed, assuming STEP itself is correctly constructed. This is comparing two STEPS, not EDGES, so only the dst need to be compared. There is also no src member in STEP.

This diff avoids treating two physical versions of the same self-reflective edges (constructed as STEPs here) as different.

@Sophie-Xie Sophie-Xie merged commit b7ce0d2 into vesoft-inc:master Mar 28, 2023
@xtcyclist xtcyclist deleted the fix_path_equal branch March 28, 2023 06:15
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.

Wrong comparisons of paths involving self-reflective edges
5 participants