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


##########
common/utils/src/main/resources/error/error-classes.json:
##########
@@ -1,4 +1,32 @@
 {
+  "AGGREGATE_FILTER_EXPRESSION_ERROR" : {
+    "message" : [
+      "FILTER expression in aggregate function has errors:"

Review Comment:
   When an user query is big enough, it is hard to identify which filter the 
error belongs to. Let's help to user, and point out the filter expression:
   ```suggestion
         "The FILTER expression <filterExpr> in an aggregate function is 
invalid."
   ```



##########
common/utils/src/main/resources/error/error-classes.json:
##########
@@ -1,4 +1,32 @@
 {
+  "AGGREGATE_FILTER_EXPRESSION_ERROR" : {
+    "message" : [
+      "FILTER expression in aggregate function has errors:"
+    ],
+    "subClass" : {
+      "CONTAINS_AGGREGATE" : {
+        "message" : [
+          "FILTER expression contains an aggregation."

Review Comment:
   And if you can, point out the aggregate expression. Just take 
`AggregateExpression` and pass it to `aggregateInAggregateFilterError()` in:
   ```scala
               case Some(filter) if 
filter.exists(_.isInstanceOf[AggregateExpression]) =>
                 throw QueryCompilationErrors.aggregateInAggregateFilterError()
   ```



##########
common/utils/src/main/resources/error/error-classes.json:
##########
@@ -1,4 +1,32 @@
 {
+  "AGGREGATE_FILTER_EXPRESSION_ERROR" : {
+    "message" : [
+      "FILTER expression in aggregate function has errors:"
+    ],
+    "subClass" : {
+      "CONTAINS_AGGREGATE" : {
+        "message" : [
+          "FILTER expression contains an aggregation."

Review Comment:
   Let's tell to users what we expected and what we found:
   ```suggestion
             "Expected an expression without any aggregation but found 
<aggExpr>."
   ```



##########
common/utils/src/main/resources/error/error-classes.json:
##########
@@ -1,4 +1,32 @@
 {
+  "AGGREGATE_FILTER_EXPRESSION_ERROR" : {

Review Comment:
   The `_ERROR` word is useless because all error classes in the files are 
related to errors. Let's remove the word, and assign shorted and "conditional" 
name like `INVALID_AGGREGATE_FILTER`



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