You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Peter Toth (Jira)" <ji...@apache.org> on 2020/09/24 09:08:00 UTC

[jira] [Commented] (SPARK-32983) Spark SQL INTERSECT ALL does not keep all rows.

    [ https://issues.apache.org/jira/browse/SPARK-32983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17201383#comment-17201383 ] 

Peter Toth commented on SPARK-32983:
------------------------------------

[~willddy], I think the 1 row result is correct as according to https://en.wikipedia.org/wiki/Set_operations_(SQL)
{quote}The INTERSECT ALL operator does not remove duplicate rows from the final result set, but if a row appears X times in the first query and Y times in the second, it will appear min(X, Y) times in the result set.{quote}

> Spark SQL INTERSECT ALL does not keep all rows.
> -----------------------------------------------
>
>                 Key: SPARK-32983
>                 URL: https://issues.apache.org/jira/browse/SPARK-32983
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 2.4.6, 3.0.0, 3.0.1
>            Reporter: Will Du
>            Priority: Major
>
> Spark SQL INTERSECT ALL should keep all rows. But, it actually remove replicated like Spark SQL INTERSECT.
> with base as (
> select 1 as id union all select 2 as id
> ), a as (
> select 1 as id union all select 3 as id)
> select * from a INTERSECT ALL select * from base;
>  
> with base as (
> select 1 as id union all select 2 as id
> ), a as (
> select 1 as id union all select 3 as id)
> select * from a INTERSECT select * from base;
>  
> Both the above queries return one record that is 1.
> I think the 1st query should return
> 1
> 1



--
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