spark-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wenchen Fan (Jira)" <j...@apache.org>
Subject [jira] [Assigned] (SPARK-29768) nondeterministic expression fails column pruning
Date Fri, 20 Dec 2019 13:12:00 GMT

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

Wenchen Fan reassigned SPARK-29768:
-----------------------------------

    Assignee: wuyi  (was: Wenchen Fan)

> nondeterministic expression fails column pruning
> ------------------------------------------------
>
>                 Key: SPARK-29768
>                 URL: https://issues.apache.org/jira/browse/SPARK-29768
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 2.4.4
>            Reporter: yucai
>            Assignee: wuyi
>            Priority: Major
>             Fix For: 3.0.0
>
>
> nondeterministic expression like monotonically_increasing_id fails column pruning
> {code}
>     spark.range(10).selectExpr("id as key", "id * 2 as value").
>       write.format("parquet").save("/tmp/source")
>     spark.range(10).selectExpr("id as key", "id * 3 as s1", "id * 5 as s2").
>       write.format("parquet").save("/tmp/target")
>     val sourceDF = spark.read.parquet("/tmp/source")
>     val targetDF = spark.read.parquet("/tmp/target").
>       withColumn("row_id", monotonically_increasing_id())
>     sourceDF.join(targetDF, "key").select("key", "row_id").explain()
> {code}
> Spark reads all columns from targetDF, but actually, we only need `key` column.
> {code}
> scala>     sourceDF.join(targetDF, "key").select("key", "row_id").explain()
> == Physical Plan ==
> *(2) Project [key#78L, row_id#88L]
> +- *(2) BroadcastHashJoin [key#78L], [key#82L], Inner, BuildLeft
>    :- BroadcastExchange HashedRelationBroadcastMode(List(input[0, bigint, true]))
>    :  +- *(1) Project [key#78L]
>    :     +- *(1) Filter isnotnull(key#78L)
>    :        +- *(1) FileScan parquet [key#78L] Batched: true, Format: Parquet, Location:
InMemoryFileIndex[file:/tmp/source], PartitionFilters: [], PushedFilters: [IsNotNull(key)],
ReadSchema: struct<key:bigint>
>    +- *(2) Filter isnotnull(key#82L)
>       +- *(2) Project [key#82L, monotonically_increasing_id() AS row_id#88L]
>          +- *(2) FileScan parquet [key#82L,s1#83L,s2#84L] Batched: true, Format: Parquet,
Location: InMemoryFileIndex[file:/tmp/target], PartitionFilters: [], PushedFilters: [], ReadSchema:
struct<key:bigint,s1:bigint,s2:bigint>
> {code}



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


Mime
View raw message