You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Andrey Gubichev (Jira)" <ji...@apache.org> on 2023/09/29 16:05:00 UTC
[jira] [Updated] (SPARK-45381) Incorrect COUNT bug handling in scalar subqueries
[ https://issues.apache.org/jira/browse/SPARK-45381?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andrey Gubichev updated SPARK-45381:
------------------------------------
Description:
This query has incorrect results:
create temp view l (a, b)
as values
(1, 2.0),
(1, 2.0),
(2, 1.0),
(2, 1.0),
(3, 3.0),
(null, null),
(null, 5.0),
(6, null);
create temp view r (c, d)
as values
(2, 3.0),
(2, 3.0),
(3, 2.0),
(4, 1.0),
(null, null),
(null, 5.0),
(6, null);
select (
select sum(cnt)
from (select count ( * ) cnt from r where l.a = r.c)
) from l;
It returns
– !query output
1
1
2
2
NULL
NULL
NULL
NULL
NULLs in the output should be zeros.
was:
This query has incorrect results:
create temp view l (a, b)
as values
(1, 2.0),
(1, 2.0),
(2, 1.0),
(2, 1.0),
(3, 3.0),
(null, null),
(null, 5.0),
(6, null);
create temp view r (c, d)
as values
(2, 3.0),
(2, 3.0),
(3, 2.0),
(4, 1.0),
(null, null),
(null, 5.0),
(6, null);
select (
select sum(cnt)
from (select count(*) cnt from r where l.a = r.c)
) from l;
It returns
-- !query output
1
1
2
2
NULL
NULL
NULL
NULL
NULLs in the output should be zeros.
> Incorrect COUNT bug handling in scalar subqueries
> -------------------------------------------------
>
> Key: SPARK-45381
> URL: https://issues.apache.org/jira/browse/SPARK-45381
> Project: Spark
> Issue Type: Bug
> Components: SQL
> Affects Versions: 3.5.0
> Reporter: Andrey Gubichev
> Priority: Major
>
> This query has incorrect results:
> create temp view l (a, b)
> as values
> (1, 2.0),
> (1, 2.0),
> (2, 1.0),
> (2, 1.0),
> (3, 3.0),
> (null, null),
> (null, 5.0),
> (6, null);
> create temp view r (c, d)
> as values
> (2, 3.0),
> (2, 3.0),
> (3, 2.0),
> (4, 1.0),
> (null, null),
> (null, 5.0),
> (6, null);
> select (
> select sum(cnt)
> from (select count ( * ) cnt from r where l.a = r.c)
> ) from l;
>
>
> It returns
> – !query output
> 1
> 1
> 2
> 2
> NULL
> NULL
> NULL
> NULL
> NULLs in the output should be zeros.
>
--
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