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/11/08 14:35:14 UTC

[GitHub] [spark] MaxGekk commented on a diff in pull request #38555: [SPARK-41044][SQL] Convert DATATYPE_MISMATCH.UNSPECIFIED_FRAME to DATATYPE_MISMATCH.INTERNAL_ERROR

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


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/windowExpressions.scala:
##########
@@ -66,7 +66,13 @@ case class WindowSpecDefinition(
   override def checkInputDataTypes(): TypeCheckResult = {
     frameSpecification match {
       case UnspecifiedFrame =>
-        DataTypeMismatch(errorSubClass = "UNSPECIFIED_FRAME")
+        DataTypeMismatch(

Review Comment:
   @panbingkun Could you throw `SparkException.internalError`



##########
core/src/main/resources/error/error-classes.json:
##########
@@ -219,6 +219,11 @@
           "Input to the function <functionName> cannot contain elements of the \"MAP\" type. In Spark, same maps may have different hashcode, thus hash expressions are prohibited on \"MAP\" elements. To restore previous behavior set \"spark.sql.legacy.allowHashOnMapType\" to \"true\"."
         ]
       },
+      "INTERNAL_ERROR" : {

Review Comment:
   I don't think we should introduce such sub-class. Could you re-use the existing `INTERNAL_ERROR`:
   https://github.com/apache/spark/blob/31b923d50fa6176312f7217069c0055cd778788f/core/src/main/resources/error/error-classes.json#L557-L561



##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/windowExpressions.scala:
##########
@@ -66,7 +66,13 @@ case class WindowSpecDefinition(
   override def checkInputDataTypes(): TypeCheckResult = {
     frameSpecification match {
       case UnspecifiedFrame =>
-        DataTypeMismatch(errorSubClass = "UNSPECIFIED_FRAME")
+        DataTypeMismatch(
+          errorSubClass = "INTERNAL_ERROR",
+          messageParameters = Map(
+            "message" -> ("Cannot use an UnspecifiedFrame. " +
+              "This should have been converted during analysis.")

Review Comment:
   Both checks exist in the source code from the first commit:
   https://github.com/apache/spark/commit/f2c47082c3412a4cf8cbabe12585147c5ec3ea40
   I would leaved `case UnspecifiedFrame` as is to cover the bad situation explicitly.



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