francis0407 commented on issue #23783: [SPARK-26854][SQL] Support ANY/SOME subquery URL: https://github.com/apache/spark/pull/23783#issuecomment-476089820 @dongjoon-hyun Thanks for review. > I'm wondering if we can achieve this by adding an optimizer rule. For example, `SOME` to `EXISTS` query. How do you think about this? > > ```sql > SELECT t1.id FROM t1 WHERE t1.id = SOME (SELECT t2.id FROM t2) > ``` > > => > > ```sql > SELECT t1.id FROM t1 WHERE EXISTS (SELECT t2.id FROM t2 WHERE t1.id = t2.id) > ``` Currently, we implement this using the rule `RewritePredicateSubquery`. We simply use the existed case for `InSubquery`, and it will also work for `AllSubquery`. As for your suggestion, although it needs more codes for implementation, it is useful for the later processing because we only need to handle the case for `Exists` then. So I'm neutral for this.
---------------------------------------------------------------- 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]
