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


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala:
##########
@@ -1563,10 +1563,12 @@ private[sql] object QueryCompilationErrors extends 
QueryErrorsBase {
     new AnalysisException(s"'$operation' does not support partitioning")
   }
 
-  def mixedRefsInAggFunc(funcStr: String): Throwable = {
-    val msg = "Found an aggregate function in a correlated predicate that has 
both " +
-      "outer and local references, which is not supported: " + funcStr
-    new AnalysisException(msg)
+  def mixedRefsInAggFunc(funcStr: String, origin: Origin): Throwable = {
+    new AnalysisException(
+      errorClass = "UNSUPPORTED_SUBQUERY_EXPRESSION_CATEGORY",
+      errorSubClass = "AGGREGATE_FUNCTION_MIXED_OUTER_LOCAL_REFERENCES",
+      origin = origin,
+      messageParameters = Map("function" -> funcStr))

Review Comment:
   Good Q,
   Looks like this is a `sql` string generated from a predicate which may 
contain multiple functions. It renders from the error-classes.json file like 
this:
   
   ```
   Found an aggregate function in a correlated predicate that has both outer 
and local references, which is not supported: <function>
   ```
   
   It might be better to leave it unquoted since some parts of the predicate 
may contain their own double-quotes, e.g. literal string values. Will leave it 
alone for now, Serge please comment if you want it to work differently and I 
can update it.



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