You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/10/26 16:24:26 UTC
[GitHub] [spark] allisonwang-db commented on a diff in pull request #38336: [SPARK-40862][SQL] Support non-aggregated subqueries in RewriteCorrelatedScalarSubquery
allisonwang-db commented on code in PR #38336:
URL: https://github.com/apache/spark/pull/38336#discussion_r1005902371
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/subquery.scala:
##########
@@ -561,14 +566,18 @@ object RewriteCorrelatedScalarSubquery extends Rule[LogicalPlan] with AliasHelpe
val origOutput = query.output.head
val resultWithZeroTups = evalSubqueryOnZeroTups(query)
- if (resultWithZeroTups.isEmpty) {
+ lazy val (topPart, havingNode, aggNode) = splitSubquery(query)
Review Comment:
Wouldn't this short circuit?
```
if (resultWithZeroTups.isEmpty || aggNode.isEmpty) {
```
If `resultWithZeroTups` is empty, then `aggNode` won't get accessed. I am trying to prevent splitting the subquery when it is not subject to the count bug.
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org