You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/10/13 05:51:43 UTC

[GitHub] [spark] MaxGekk commented on a diff in pull request #38234: [WIP][SPARK-40761][SQL] Migrate type check failures of percentile expressions onto error classes

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


##########
core/src/main/resources/error/error-classes.json:
##########
@@ -951,6 +951,45 @@
       "3. set \"spark.sql.legacy.allowUntypedScalaUDF\" to \"true\" and use this API with caution"
     ]
   },
+  "INVALID_PERCENTAGES" : {
+    "message" : [
+      "The percentage(s) "
+    ],
+    "subClass" : {

Review Comment:
   Please, move to the error class `DATATYPE_MISMATCH`



##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/ApproximatePercentile.scala:
##########
@@ -118,17 +118,32 @@ case class ApproximatePercentile(
     val defaultCheck = super.checkInputDataTypes()
     if (defaultCheck.isFailure) {
       defaultCheck
-    } else if (!percentageExpression.foldable || !accuracyExpression.foldable) {
-      TypeCheckFailure(s"The accuracy or percentage provided must be a constant literal")
+    } else if (!percentageExpression.foldable) {
+      DataTypeMismatch(
+        errorSubClass = "INVALID_PERCENTAGES.MUST_CONSTANT",

Review Comment:
   Pass just an error sub-classes of `DATATYPE_MISMATCH`.



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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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