bersprockets opened a new pull request, #42064:
URL: https://github.com/apache/spark/pull/42064

   ### What changes were proposed in this pull request?
   
   In `CheckAnalysis#checkAnalysis0`, qualify the error subclass 
`TYPE_CHECK_FAILURE_WITH_HINT` with the error class `DATATYPE_MISMATCH`.
   
   ### Why are the changes needed?
   
   `CheckAnalysis` treats `TYPE_CHECK_FAILURE_WITH_HINT` as an error class, but 
it is actually an error subclass of `DATATYPE_MISMATCH`.
   ```
   spark-sql (default)> select bitmap_count(12);
   [INTERNAL_ERROR] Cannot find main error class 'TYPE_CHECK_FAILURE_WITH_HINT'
   org.apache.spark.SparkException: [INTERNAL_ERROR] Cannot find main error 
class 'TYPE_CHECK_FAILURE_WITH_HINT'
        at 
org.apache.spark.SparkException$.internalError(SparkException.scala:83)
        at 
org.apache.spark.SparkException$.internalError(SparkException.scala:87)
        at 
org.apache.spark.ErrorClassesJsonReader.$anonfun$getMessageTemplate$1(ErrorClassesJSONReader.scala:68)
        at 
scala.collection.immutable.HashMap$HashMap1.getOrElse0(HashMap.scala:361)
        at 
scala.collection.immutable.HashMap$HashTrieMap.getOrElse0(HashMap.scala:594)
        at 
scala.collection.immutable.HashMap$HashTrieMap.getOrElse0(HashMap.scala:589)
        at scala.collection.immutable.HashMap.getOrElse(HashMap.scala:73)
   ```
   This issue only occurs when an expression uses 
`TypeCheckResult.TypeCheckFailure` to indicate input type check failure. 
`TypeCheckResult.TypeCheckFailure` appears to be deprecated in favor of 
`TypeCheckResult.DataTypeMismatch`, but recently two expressions were added 
that use `TypeCheckResult.TypeCheckFailure`: `BitmapCount` and `BitmapOrAgg`.
   
   `BitmapCount` and `BitmapOrAgg` should probably be fixed to use 
`TypeCheckResult.DataTypeMismatch`. Regardless, the code in `CheckAnalysis` 
that handles `TypeCheckResult.TypeCheckFailure` should either be fixed or 
removed. In this PR, I chose to fix it.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No, except for the user seeing the correct error message.
   
   ### How was this patch tested?
   
   New unit test.
   


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