AngersZhuuuu commented on a change in pull request #29075:
URL: https://github.com/apache/spark/pull/29075#discussion_r453394363
##########
File path:
sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/PruneHiveTablePartitions.scala
##########
@@ -54,9 +55,15 @@ private[sql] class PruneHiveTablePartitions(session:
SparkSession)
val normalizedFilters = DataSourceStrategy.normalizeExprs(
filters.filter(f => f.deterministic &&
!SubqueryExpression.hasSubquery(f)), relation.output)
val partitionColumnSet = AttributeSet(relation.partitionCols)
- ExpressionSet(normalizedFilters.filter { f =>
+ val (partitionFilters, remainingFilters) = normalizedFilters.partition { f
=>
!f.references.isEmpty && f.references.subsetOf(partitionColumnSet)
- })
+ }
+ // Try extracting more convertible partition filters from the remaining
filters by converting
+ // them into CNF.
+ val remainingFilterInCnf = remainingFilters.flatMap(CNFConversion)
+ val extraPartitionFilters = remainingFilterInCnf.filter(f =>
+ !f.references.isEmpty && f.references.subsetOf(partitionColumnSet))
+ ExpressionSet(partitionFilters ++ extraPartitionFilters)
Review comment:
I am confused that seems CNFConversion won't change references, You
don't need to call a `splitConjunctivePredicates` to each expr in
`remainingFilterInCnf` to extract more predicate?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]