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/11 19:18:38 UTC

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

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



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



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