gengliangwang commented on code in PR #37840:
URL: https://github.com/apache/spark/pull/37840#discussion_r971390448


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala:
##########
@@ -823,12 +834,16 @@ trait CheckAnalysis extends PredicateHelper with 
LookupCatalog {
               // it must also be in the aggregate expressions to be rewritten 
in the optimization
               // phase.
               if (containsExpr(a.groupingExpressions) && 
!containsExpr(a.aggregateExpressions)) {
-                failAnalysis("Correlated scalar subqueries in the group by 
clause " +
-                  s"must also be in the aggregate expressions:\n$a")
+                a.failAnalysis(
+                  errorClass = "UNSUPPORTED_SUBQUERY_EXPRESSION_CATEGORY",
+                  errorSubClass = "MUST_AGGREGATE_CORRELATED_SCALAR_SUBQUERY",
+                  treeNodes = Seq(a))

Review Comment:
   why do we need to pass `a` itself?



-- 
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: [email protected]

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