MaxGekk commented on code in PR #37742:
URL: https://github.com/apache/spark/pull/37742#discussion_r960464975


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala:
##########
@@ -2527,4 +2527,11 @@ private[sql] object QueryCompilationErrors extends 
QueryErrorsBase {
       errorClass = "INVALID_COLUMN_OR_FIELD_DATA_TYPE",
       messageParameters = Array(toSQLId(name), toSQLType(dt), 
toSQLType(expected)))
   }
+
+  def columnNotInGroupByClauseError(expression: Expression): Throwable = {
+    new AnalysisException(
+      errorClass = "COLUMN_NOT_IN_GROUP_BY_CLAUSE",
+      messageParameters = Array(expression.sql)

Review Comment:
   expression.sql -> toSQLExpr(expression)



##########
core/src/main/resources/error/error-classes.json:
##########
@@ -65,6 +65,12 @@
     ],
     "sqlState" : "22005"
   },
+  "COLUMN_NOT_IN_GROUP_BY_CLAUSE" : {
+    "message" : [
+      "expression '<expression>' is neither present in the group by, nor is it 
an aggregate function. Add to group by or wrap in first() (or first_value) if 
you don't care which value you get."

Review Comment:
   Please, remove '' around <expression> and use toSQLExpr(), and first() 
should be quoted by back ticks. 



-- 
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-unsubscr...@spark.apache.org

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