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

Remove glr parser #5290

Merged
merged 4 commits into from
Feb 6, 2023
Merged

Conversation

czpmango
Copy link
Contributor

@czpmango czpmango commented Jan 31, 2023

The previous implementation of pattern expression introduce bison glr parser to handle conflicts, but that is actually unnecessary and harmful. This pr refactors the implementation and fix some related bugs.

What type of PR is this?

  • bug
  • feature
  • enhancement

What problem(s) does this PR solve?

Issue(s) number:

#5235

Description:

Checklist:

Tests:

  • Unit test(positive and negative cases)
  • Function test
  • Performance test
  • 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

@czpmango czpmango marked this pull request as draft January 31, 2023 02:13
@czpmango czpmango force-pushed the fix/remove-glr-parser branch 2 times, most recently from aa0ae73 to 3c941d2 Compare January 31, 2023 07:53
@czpmango czpmango marked this pull request as ready for review January 31, 2023 07:54
@czpmango czpmango added ready-for-testing PR: ready for the CI test ready for review labels Jan 31, 2023
@czpmango czpmango added the doc affected PR: improvements or additions to documentation label Jan 31, 2023
Copy link
Contributor

@yixinglu yixinglu left a comment

Choose a reason for hiding this comment

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

LGTM, prefer to test the case in #5221 and following tests:

with [1,2] as a, 2 as b, [1] as c return (a)-[b]-(c);
with [1,2] as a, 2 as b, [1] as c return (a)- [b] -(c);

| parenthesized_expression {
auto& e = $1;
if (e->kind() != Expression::Kind::kLabel) {
throw nebula::GraphParser::syntax_error(@1, "Invalid node pattern");
Copy link
Contributor

Choose a reason for hiding this comment

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

delete $1 before throw exception

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ACK.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The expression memory is managed by ObjectPool, and there is no need for delete, which would result in double free.

small fix

fix tck

fmt

fix tck

add test cases

add tck
Copy link
Contributor

@yixinglu yixinglu 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!

@codesigner
Copy link
Contributor

codesigner commented Feb 6, 2023

This fixed some patten expressibility broblems, but also introduce some compatibility(which is not very common), we should notice the change in release note when 3.5 released. @Sophie-Xie

@Sophie-Xie Sophie-Xie merged commit fa117fe into vesoft-inc:master Feb 6, 2023
@Sophie-Xie Sophie-Xie added the incompatible PR: incompatible with the recently released version label Feb 6, 2023
@Sophie-Xie
Copy link
Contributor

This fixed some patten expressibility problems, but also introduce some compatibility(which is not very common), we should notice the change in release note when 3.5 released. @Sophie-Xie

@MuYiYong pls review this incompatible pr, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc affected PR: improvements or additions to documentation incompatible PR: incompatible with the recently released version 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.

6 participants