cloud-fan commented on code in PR #38626: URL: https://github.com/apache/spark/pull/38626#discussion_r1021139971
########## sql/core/src/main/scala/org/apache/spark/sql/execution/SparkOptimizer.scala: ########## @@ -51,8 +51,10 @@ class SparkOptimizer( Batch("Optimize Metadata Only Query", Once, OptimizeMetadataOnlyQuery(catalog)) :+ Batch("PartitionPruning", Once, PartitionPruning, - RowLevelOperationRuntimeGroupFiltering, - OptimizeSubqueries) :+ + // We can't run `OptimizeSubqueries` in this batch, as it will optimize the subqueries + // twice which may break some optimizer rules that can only be applied once. The rule below + // only invokes `OptimizeSubqueries` to optimize newly added subqueries. Review Comment: inspired by https://github.com/apache/spark/pull/38619 , maybe we don't need to invoke the entire optimizer, but just a few rules to optimize this subquery. -- 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. To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org