[
https://issues.apache.org/jira/browse/SPARK-38570?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17512195#comment-17512195
]
Apache Spark commented on SPARK-38570:
--------------------------------------
User 'mcdull-zhang' has created a pull request for this issue:
https://github.com/apache/spark/pull/35967
> Incorrect DynamicPartitionPruning caused by Literal
> ---------------------------------------------------
>
> Key: SPARK-38570
> URL: https://issues.apache.org/jira/browse/SPARK-38570
> Project: Spark
> Issue Type: Improvement
> Components: SQL
> Affects Versions: 3.2.0
> Reporter: mcdull_zhang
> Assignee: mcdull_zhang
> Priority: Minor
> Fix For: 3.3.0
>
>
> The return value of Literal.references is an empty AttributeSet, so Literal
> is mistaken for a partition column.
>
> org.apache.spark.sql.execution.dynamicpruning.PartitionPruning#getFilterableTableScan:
> {code:java}
> val srcInfo: Option[(Expression, LogicalPlan)] =
> findExpressionAndTrackLineageDown(a, plan)
> srcInfo.flatMap {
> case (resExp, l: LogicalRelation) =>
> l.relation match {
> case fs: HadoopFsRelation =>
> val partitionColumns = AttributeSet(
> l.resolve(fs.partitionSchema,
> fs.sparkSession.sessionState.analyzer.resolver))
> // When resExp is a Literal, Literal is considered a partition
> column.
> if (resExp.references.subsetOf(partitionColumns)) {
> return Some(l)
> } else {
> None
> }
> case _ => None
> } {code}
--
This message was sent by Atlassian Jira
(v8.20.1#820001)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]