spark-rapids
spark-rapids copied to clipboard
[SPARK-40044][SQL] Fix the target interval type in cast overflow errors
Context
- https://github.com/apache/spark/commit/7ae2b85c48
- Rapids ISsues: https://github.com/NVIDIA/spark-rapids/issues/6293
What changes were proposed in SPARK pull request?
fix the incorrect target type in the error message of the cast overflow. For example:
spark-sql> select CAST(9223372036854775807L AS INTERVAL YEAR TO MONTH);
org.apache.spark.SparkArithmeticException: [CAST_OVERFLOW] The value 9223372036854775807L of the type "BIGINT" cannot be cast to "INTERVAL MONTH" due to an overflow.
The target type is "INTERVAL MONTH" instead of "INTERVAL YEAR TO MONTH".
Why changes were needed?
To improve user experience After the changes, for the example above:
spark-sql> select CAST(9223372036854775807L AS INTERVAL YEAR TO MONTH);
org.apache.spark.SparkArithmeticException: [CAST_OVERFLOW] The value 9223372036854775807L of the type "BIGINT" cannot be cast to "INTERVAL YEAR TO MONTH" due to an overflow.
Does this PR introduce any user-facing change?
Yes, improve error message
Why it might affect RAPIDS?
change of error handling
Impact on Testing?
No
Requires Doc update?
No