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 issue that missing identifiers from ANTLR keywords #821

Merged
merged 1 commit into from
Oct 29, 2024

Conversation

LantaoJin
Copy link
Member

Description

This PR is sourcing from fixing the problem introduced by #723:
| stats sum(1) as value failed due to #723 introduced a keyword VALUE but not marked as Id in ANTLR file.

Then I identified there are not only VALUE, but also more invalid keywords as identifier in g4 file.

Related Issues

Resolves #820

Check List

  • Updated documentation (docs/ppl-lang/README.md)
  • Implemented unit tests
  • Implemented tests for combination with other commands
  • New added source code should include a copyright header
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Comment on lines -77 to -82
VALUE: 'VALUE';
USING: 'USING';
WITH: 'WITH';

// CLAUSE KEYWORDS
SORTBY: 'SORTBY';
Copy link
Member Author

Choose a reason for hiding this comment

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

These two keywords are not used at all in parser.

@@ -55,6 +55,35 @@ commands
| fieldsummaryCommand
;

commandName
Copy link
Member Author

Choose a reason for hiding this comment

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

Add a new variable commandName, all new command (not function) should be added in this list.

Comment on lines -363 to -369
takeAggFunction
: TAKE LT_PRTHS fieldExpression (COMMA size = integerLiteral)? RT_PRTHS
;

percentileAggFunction
: PERCENTILE LESS value = integerLiteral GREATER LT_PRTHS aggField = fieldExpression RT_PRTHS
;
Copy link
Member Author

Choose a reason for hiding this comment

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

Never used.

Copy link
Member

Choose a reason for hiding this comment

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

good catch

Copy link
Member

Choose a reason for hiding this comment

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

@kt-eliatra @salyh please make sure why this is not in use

Copy link
Contributor

Choose a reason for hiding this comment

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

Thats not from us and in the g4 files there are plenty of unused statements. And also unused code in the code base btw :-)

Copy link
Contributor

Choose a reason for hiding this comment

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

percentileAgg != percentile (see blame)

OpenSearchPPLParser g4 at 7bc09278d8a9d7df05ff2e086e7f430a4a0da3… 2024-10-28 19-22-32

@LantaoJin LantaoJin added maintenance Code refactoring Lang:PPL Pipe Processing Language support 0.6 bug Something isn't working labels Oct 28, 2024
@LantaoJin LantaoJin marked this pull request as ready for review October 28, 2024 09:30
@LantaoJin LantaoJin merged commit 9d2f94d into opensearch-project:main Oct 29, 2024
8 checks passed
kenrickyap pushed a commit to Bit-Quill/opensearch-spark that referenced this pull request Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.6 bug Something isn't working Lang:PPL Pipe Processing Language support maintenance Code refactoring
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] VALUE keyword cannot be used as identifier
3 participants