You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/02/16 08:40:46 UTC

[GitHub] [spark] c21 commented on a change in pull request #31542: [SPARK-34414][SQL] OptimizeMetadataOnlyQuery should only apply for deterministic filters

c21 commented on a change in pull request #31542:
URL: https://github.com/apache/spark/pull/31542#discussion_r576639301



##########
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:
       nit: why not just `filters.forall(_.deterministic)`? 




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org