maropu commented on a change in pull request #29585:
URL: https://github.com/apache/spark/pull/29585#discussion_r482589775



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/subquery.scala
##########
@@ -564,60 +572,85 @@ object RewriteCorrelatedScalarSubquery extends 
Rule[LogicalPlan] {
               case op => sys.error(s"Unexpected operator $op in corelated 
subquery")
             }
 
-            // CASE WHEN alwaysTrue IS NULL THEN resultOnZeroTups
-            //      WHEN NOT (original HAVING clause expr) THEN CAST(null AS 
<type of aggVal>)
-            //      ELSE (aggregate value) END AS (original column name)
-            val caseExpr = Alias(CaseWhen(Seq(
-              (IsNull(alwaysTrueRef), resultWithZeroTups.get),
-              (Not(havingNode.get.condition), Literal.create(null, 
aggValRef.dataType))),
-              aggValRef),
-              origOutput.name)(exprId = origOutput.exprId)

Review comment:
       NOTE: Found by the integrity check: 
https://github.com/apache/spark/pull/29585/files#diff-27c76f96a7b2733ecfd6f46a1716e153R238




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



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

Reply via email to