dilipbiswal commented on a change in pull request #23211: [SPARK-19712][SQL] 
Move PullupCorrelatedPredicates and RewritePredicateSubquery after 
OptimizeSubqueries
URL: https://github.com/apache/spark/pull/23211#discussion_r240352498
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
 ##########
 @@ -649,13 +664,16 @@ object CollapseProject extends Rule[LogicalPlan] {
 
   def apply(plan: LogicalPlan): LogicalPlan = plan transformUp {
     case p1 @ Project(_, p2: Project) =>
-      if (haveCommonNonDeterministicOutput(p1.projectList, p2.projectList)) {
+      if (haveCommonNonDeterministicOutput(p1.projectList, p2.projectList) ||
+        ScalarSubquery.hasScalarSubquery(p1.projectList) ||
+        ScalarSubquery.hasScalarSubquery(p2.projectList)) {
 
 Review comment:
   @cloud-fan.. Let me get back to you on this, need to debug again :-)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

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

Reply via email to