You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Yuming Wang (Jira)" <ji...@apache.org> on 2020/11/02 06:57:00 UTC

[jira] [Created] (SPARK-33315) simplify CaseWhen with EqualTo

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-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org