AngersZhuuuu commented on a change in pull request #26437: [SPARK-29800][SQL] 
Rewrite non-correlated subquery use ScalaSubquery to optimize perf
URL: https://github.com/apache/spark/pull/26437#discussion_r363139303
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/finishAnalysis.scala
 ##########
 @@ -52,6 +52,21 @@ object ReplaceExpressions extends Rule[LogicalPlan] {
   }
 }
 
+/**
+ * Rewrite non correlated exists subquery to use ScalarSubquery
+ *   WHERE EXISTS (SELECT A FROM TABLE B WHERE COL1 > 10)
+ * will be rewrite to
+ *   WHERE (SELECT 1 FROM (SELECT A FROM TABLE B WHERE COL1 > 10) LIMIT 1) IS 
NOT NULL
+ */
+object RewriteNonCorrelatedExists extends Rule[LogicalPlan] {
 
 Review comment:
   > Shall we add a test for this rule?
   
   I found that there is no DSL function of EXISTS. Should we add this? cc 
@cloud-fan 

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