Yuming Wang created SPARK-33315:
-----------------------------------

             Summary: simplify CaseWhen with EqualTo
                 Key: SPARK-33315
                 URL: https://issues.apache.org/jira/browse/SPARK-33315
             Project: Spark
          Issue Type: Improvement
          Components: SQL
    Affects Versions: 3.1.0
            Reporter: Yuming Wang


{code:sql}
create table t(a int, b int, c int) using parquet;
SELECT * 
FROM   (SELECT CASE 
                 WHEN a = 100 THEN 1 
                 WHEN b > 1000 THEN 2 
                 WHEN c IS NOT NULL THEN 3 
               END AS x 
        FROM   t) tmp 
WHERE  x = 2
{code}


{noformat}
Before this PR:
Filter (CASE WHEN (a#1 = 100) THEN 1 WHEN (b#2 > 1000) THEN 2 WHEN 
isnotnull(c#3) THEN 3 END = 2)

After this PR:
Filter (b#2 > 1000)
{noformat}




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to