[BUG] Predicates expression containing multiple AND
and OR
operators evaluated with wrong order
#770
Labels
bug
Something isn't working
correctness
Does not produce the expected outcome even though it doesn’t crash
What is the bug?
a predicate expression containing multiple
AND
andOR
operators does have an order of evaluation. This order is determined by precedence rules, just like in arithmetic where multiplication has higher precedence than addition.In SQL:
AND
has higher precedence thanOR
.Parentheses
can be used to explicitly define the desired order of operations and to override the default precedence.Example Without Parentheses:
In this query, the
AND
betweenjob_title = 'Manager'
andsalary > 50000
is evaluated first, becauseAND
has higher precedence thanOR
. It equals toBut in PPL, this query will be evaluated with wrong order:
was evaluated to
The text was updated successfully, but these errors were encountered: