-
Notifications
You must be signed in to change notification settings - Fork 150
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
[BUG] Issues in PPL grammar #3391
Comments
Thanks for opening issue @vikhy-aws , here is my thoughts
|
For 2, the fixing depends on merging dev branch to main. It reminds me to backport them to 2.x, added an item in #3394. |
Thanks for the clarification @LantaoJin. To provide a little context, I'm using only the grammar to generate parse tree and use that parse tree. So for 1, would it be possible to ensure that the precedence rules are accounted for in the grammar? Thanks for the PR for 2, and for 3 I think it's handled in the before the lexer I guess. So, should be fine. |
I do think so. But seems not a problem for running a PPL query. Do you want to use this grammar file to do some frontend work? If necessary, I can try to fix it. Let's use this issue to track for a patch (I prefer to fix it in the mentioned dev branch first). |
Yes, I'm build upon the grammar for code generation. The fix would be helpful. Thanks! |
What is the bug?
PPL grammar currently does not account for precedence for logical operators (AND, OR, XOR, NOT). Also, usage of parentheses is not supported in logical expressions. Also, the grammar is not case-agnostic, only supports uppercase.
How can one reproduce the bug?
All these can be simulated using antlr parser using sample PPL queries and the grammar.
What is the expected behavior?
Precedence must be accounted for logical operators according to the rules of the language. Usage of parentheses must be allowed in logical expressions. Also, support case-agnostic queries.
What is your host/environment?
Do you have any screenshots?
Query Used:
SOURCE=TEST | WHERE A1 = 'V1' AND A2 = 'V2' AND A3 = 'V3' OR A4 = 'V4'
Do you have any additional context?
Precedence can be enforced by having the grammar to generate lower precedence operators first and generate higher precedence operators further down the parse tree. Currently, they are being generated at the same level in the grammar which is causing the issues with precedence.
Support for case-agnostic grammar can be supported using fragments.
The text was updated successfully, but these errors were encountered: