You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Xiao Li (Jira)" <ji...@apache.org> on 2019/11/06 07:14:00 UTC
[jira] [Assigned] (SPARK-29768) nondeterministic expression fails
column pruning
[ https://issues.apache.org/jira/browse/SPARK-29768?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Xiao Li reassigned SPARK-29768:
-------------------------------
Assignee: 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: Wenchen Fan
> Priority: Major
>
> 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