Wan Kun created SPARK-42223:
-------------------------------

             Summary: Remove duplicat branch in CASE_WHEN and COALESCE function
                 Key: SPARK-42223
                 URL: https://issues.apache.org/jira/browse/SPARK-42223
             Project: Spark
          Issue Type: Improvement
          Components: SQL
    Affects Versions: 3.4.0
            Reporter: Wan Kun


We can remove the duplicate branches in CASE_WHEN and COALESCE function.

For example:
{code:sql}
SELECT
  CASE WHEN id = 200 THEN 1
       WHEN id = 200 THEN 2 -- same condition, can remove
       WHEN id = 200 THEN 3 -- same condition, can remove
       ELSE 0 END as c1,
  coalesce(
    id + 1,
    id + 1, -- same expression, can remove
    id) as c2
FROM t1
{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to