Linhong Liu created SPARK-60576:
-----------------------------------
Summary: Parenthesize NOT operands in connector comparisons
Key: SPARK-60576
URL: https://issues.apache.org/jira/browse/SPARK-60576
Project: Spark
Issue Type: Bug
Components: SQL
Affects Versions: 5.0.0
Reporter: Linhong Liu
V2ExpressionSQLBuilder.inputToSQL adds parentheses only for expressions with
multiple children. NOT has one child but lower SQL precedence than comparison
operators, so it also needs grouping when used as a comparison operand.
This also affects the IS NULL and IS NOT NULL checks synthesized for null-safe
equality. For example, (NOT a) <=> b with a=true and b=false should be true,
but without operand grouping the generated null-safe equality expression
evaluates to false.
Group NOT operands in inputToSQL. Cover NOT on the left, right and both sides
of comparisons, null-safe equality, and all combinations of TRUE, FALSE and
NULL.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]