spark-rapids
spark-rapids copied to clipboard
[FEA] [follow-up] match the Spark exceptions when cast string to timestamp
Is your feature request related to a problem? Please describe. It's from: link
Describe the solution you'd like Different Sparks have differrent behavior:
- java.time.DateTimeException: Cannot cast ABC to TimestampType.
- Or: org.apache.spark.SparkDateTimeException: [CAST_INVALID_INPUT] The value 'ABC' of the type "STRING" cannot be cast to "TIMESTAMP" because it is malformed. Correct the value as per the syntax, or change its target type. Use
try_cast
to tolerate malformed input and return NULL instead. If necessary set "spark.sql.ansi.enabled" to "false" to bypass this error.
Please check all the Spark versions.
Map java.lang.IllegalArgumentException: Parse failed on Ansi mode
to corresponding Spark Exception.
Investigate JNI code to get detailed info: "ABC" is malformed if this info can be thrown up.