Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
A literal is a constant, and so a cast of a literal is also a constant, but when we do constant reduction sometimes there are errors if the cast is not valid. For example, the query
values cast('' as integer)
gives ExceptionInInitializerError and, to make matters worse, the Avatica JDBC driver does not catch the exception (because it is a java.lang.Error) and wrap it as a java.sql.SQLException as it ought to.
Note that cast('1.2' as integer) is also invalid but cast(' -1 ' as integer) is valid.
This issue probably also applies to divide-by-zero and other exceptions evaluating scalar expressions.
Attachments
Issue Links
- is depended upon by
-
CALCITE-1620 CAST('<string>' AS BINARY) is supported by Hive, but not by Calcite
- Closed
- is related to
-
CALCITE-1653 Pass an expression executor to RexUtil.simplify for constant reduction
- Closed
- relates to
-
CALCITE-6168 RexExecutor can throw during compilation
- Resolved