-
Notifications
You must be signed in to change notification settings - Fork 181
Description
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?
- OS: Mac
- Version [e.g. 22]
- Plugins
Do you have any screenshots?
- The following screenshot shows that operator precedence is not as expected. We would expect the AND operator to be evaluated first before OR.
Query Used:SOURCE=TEST | WHERE A1 = 'V1' AND A2 = 'V2' AND A3 = 'V3' OR A4 = 'V4'

- The following screenshot show that usage of parentheses is not supported in logical expressions.

- The following screenshots show that lowercase and mixed-case queries are not supported


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.