Linhong Liu created SPARK-60575:
-----------------------------------

             Summary: Preserve compound operand grouping in connector IN 
expressions
                 Key: SPARK-60575
                 URL: https://issues.apache.org/jira/browse/SPARK-60575
             Project: Spark
          Issue Type: Bug
          Components: SQL
    Affects Versions: 5.0.0
            Reporter: Linhong Liu


V2ExpressionSQLBuilder does not group the left operand of IN. For an operand 
containing NOT, OR or another predicate, the generated SQL can parse 
differently from the original expression.

For example, (NOT a) IN (true, false) is rendered as NOT (a) IN (true, false). 
With a=true, the original expression evaluates to true but the generated SQL 
evaluates to false.

Reuse the existing operand-grouping helper so compound expressions are 
parenthesized. Simple references and self-delimiting expressions should retain 
their current SQL. Also cover the CASE expression generated for an empty IN 
list and TRUE/FALSE/NULL evaluation.




--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to