dongjoon-hyun commented on a change in pull request #31542:
URL: https://github.com/apache/spark/pull/31542#discussion_r575601360
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/OptimizeMetadataOnlyQuery.scala
##########
@@ -52,8 +52,10 @@ case class OptimizeMetadataOnlyQuery(catalog:
SessionCatalog) extends Rule[Logic
plan.transform {
case a @ Aggregate(_, aggExprs, child @ PhysicalOperation(
projectList, filters, PartitionedRelation(partAttrs, rel))) =>
- // We only apply this optimization when only partitioned attributes
are scanned.
- if (AttributeSet((projectList ++
filters).flatMap(_.references)).subsetOf(partAttrs)) {
+ // We only apply this optimization when only partitioned attributes
are scanned and filters
+ // are deterministic.
+ if (AttributeSet((projectList ++
filters).flatMap(_.references)).subsetOf(partAttrs)
+ && filters.map(_.deterministic).forall(identity)) {
Review comment:
+1 for @gatorsmile 's advice for adding a test case.
----------------------------------------------------------------
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]