spark-rapids icon indicating copy to clipboard operation
spark-rapids copied to clipboard

[FEA] [follow-up] match the Spark exceptions when cast string to timestamp

Open res-life opened this issue 1 year ago • 1 comments

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.

res-life avatar Jan 22 '24 03:01 res-life