You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Wenchen Fan (Jira)" <ji...@apache.org> on 2023/12/22 01:33:00 UTC

[jira] [Resolved] (SPARK-46468) COUNT bug in lateral/exists subqueries

     [ https://issues.apache.org/jira/browse/SPARK-46468?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Wenchen Fan resolved SPARK-46468.
---------------------------------
    Fix Version/s: 4.0.0
       Resolution: Fixed

Issue resolved by pull request 44451
[https://github.com/apache/spark/pull/44451]

> COUNT bug in lateral/exists subqueries
> --------------------------------------
>
>                 Key: SPARK-46468
>                 URL: https://issues.apache.org/jira/browse/SPARK-46468
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 3.0.0
>            Reporter: Andrey Gubichev
>            Assignee: Andrey Gubichev
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 4.0.0
>
>
> Some further instances of a COUNT bug.
>  
> One example is this test from join-lateral.sql
> [https://github.com/apache/spark/blame/master/sql/core/src/test/resources/sql-tests/results/join-lateral.sql.out#L757]
>  
> According to PostgreSQL, the query should return 2 rows:
> c1 | c2 | sum
> ---{-}++{-}--{-}{-}----
>   0 |  1 |   2
>   1 |  2 |    NULL
>  
> whereas Spark SQL only returns the first one.
>  
> Similar instance is the following query, which should return 1 row from t1 but has an empty result now:
> {{create temporary view t1(c1, c2) as values (0, 1), (1, 2);}}
> {{create temporary view t2(c1, c2) as values (0, 2), (0, 3);}}
> {{SELECT tt1.c2}}
> {{FROM t1 as tt1}}
> {{WHERE tt1.c1 in (}}
> select max(tt2.c1)
> from t2 as tt2
>  where tt1.c2 is null);



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

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