AngersZhuuuu commented on issue #26437: [SPARK-29800][SQL] Plan non-correlated 
Exists 's subquery in PlanSubqueries
URL: https://github.com/apache/spark/pull/26437#issuecomment-570112465
 
 
   > @AngersZhuuuu any updates?
   
   If use `ScalaSubquery` we can't add `Project(Nil,..)` because of 
   
https://github.com/apache/spark/blob/a6b8485eb52162faa35f5bba3ea7c85f7cdf9b5c/sql/core/src/main/scala/org/apache/spark/sql/execution/subquery.scala#L89
   
   Change like blow will work  but I can't make sure that if `executedPlan` 
will return rows without column.
   ```
         case exists: expressions.Exists =>
           val executedPlan = new QueryExecution(sparkSession, 
exists.plan).executedPlan
           IsNotNull(ScalarSubquery(
             SubqueryExec(s"scalar-subquery#${exists.exprId.id}", 
CollectLimitExec(1, executedPlan)),
             exists.exprId))
   ```
   
   For me , rewriting like this makes execution plan not match directly to  sql 
semantic. and add one physic node is acceptable for me. 
   Make Spark SQL Plan graph more readable is also more easy for most users

----------------------------------------------------------------
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]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to