You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Apache Spark (Jira)" <ji...@apache.org> on 2021/01/06 13:29:00 UTC

[jira] [Assigned] (SPARK-34031) Union operator missing rowCount when enable CBO

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

Apache Spark reassigned SPARK-34031:
------------------------------------

    Assignee: Apache Spark

> Union operator missing rowCount when enable CBO
> -----------------------------------------------
>
>                 Key: SPARK-34031
>                 URL: https://issues.apache.org/jira/browse/SPARK-34031
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 3.2.0
>            Reporter: Yuming Wang
>            Assignee: Apache Spark
>            Priority: Major
>
> {code:scala}
> spark.sql("CREATE TABLE t1 USING parquet AS SELECT id FROM RANGE(10)")
> spark.sql("CREATE TABLE t2 USING parquet AS SELECT id FROM RANGE(10)")
> spark.sql("ANALYZE TABLE t1 COMPUTE STATISTICS FOR ALL COLUMNS")
> spark.sql("ANALYZE TABLE t2 COMPUTE STATISTICS FOR ALL COLUMNS")
> spark.sql("set spark.sql.cbo.enabled=true")
> spark.sql("SELECT * FROM t1 UNION ALL SELECT * FROM t2").explain("cost")
> {code}
> Current:
> {noformat}
> == Optimized Logical Plan ==
> Union false, false, Statistics(sizeInBytes=320.0 B)
> :- Relation[id#5880L] parquet, Statistics(sizeInBytes=160.0 B, rowCount=10)
> +- Relation[id#5881L] parquet, Statistics(sizeInBytes=160.0 B, rowCount=10)
> {noformat}
> Expected
> {noformat}
> == Optimized Logical Plan ==
> Union false, false, Statistics(sizeInBytes=320.0 B, rowCount=20)
> :- Relation[id#2138L] parquet, Statistics(sizeInBytes=160.0 B, rowCount=10)
> +- Relation[id#2139L] parquet, Statistics(sizeInBytes=160.0 B, rowCount=10)
> {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