Details
-
Improvement
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
3.3.0
-
None
Description
Improve several error messages for cast failures in ANSI.
Cast to numeric types
java.lang.NumberFormatException: invalid input syntax for type numeric: 1.0. To return NULL instead, use 'try_cast'. ...
This is confusing as 1.0 is numeric to an average user. Need to mention the specific target type (integer in this case) and put 1.0 in single quotes. If we can mention this is a cast from string to an integer that’s even better.
Proposed change
Invalid `int` literal: '1.0'. To return NULL instead, use 'try_cast'.
Cast to date types
java.time.DateTimeException: Cannot cast 2021-09- 2 to DateType.
Can align with the above change.
Proposed change
Invalid `date` literal: '2021-09- 2'. To return NULL instead, use 'try_cast'.