viirya commented on a change in pull request #32503:
URL: https://github.com/apache/spark/pull/32503#discussion_r632906552



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala
##########
@@ -836,15 +836,7 @@ trait CheckAnalysis extends PredicateHelper with 
LookupCatalog {
           val outer = a.collect { case OuterReference(e) => e.toAttribute }
           val local = a.references -- outer
           if (local.nonEmpty) {
-            val msg =
-              s"""
-                 |Found an aggregate expression in a correlated predicate that 
has both
-                 |outer and local references, which is not supported yet.
-                 |Aggregate expression: 
${SubExprUtils.stripOuterReference(a).sql},
-                 |Outer references: ${outer.map(_.sql).mkString(", ")},
-                 |Local references: ${local.map(_.sql).mkString(", ")}.
-               """.stripMargin.replace("\n", " ").trim()
-            failAnalysis(msg)
+            throw QueryCompilationErrors.mixedRefsInAggFunc(a.sql)

Review comment:
       To be consistent with previous, shall we pass 
`SubExprUtils.stripOuterReference(a).sql`?




-- 
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:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to