Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.36.0
Description
The code generated by EnumUtil for casts uses the Java semantics, where casts just truncate values. The SQL semantics requires a runtime exception if the value does not fit in the target datatype.
Some of the bugs in this code generator are masked by the BlockBuilder optimizer which attempts to optimize the generated code using the SQL semantics... But if the code is not optimized and is executed in Java it generates wrong results for most conversions that overflow.
One additional wrinkle is that it is not entirely clear whether the bug is in EnumUtils or in the code that invokes EnumUtils. It is not specified which of the two semantics for casts EnumUtils are supposed to implement: Java or SQL?
Attachments
Issue Links
- is related to
-
CALCITE-6366 Code generated by EnumUtils#convert should throw an exception if the target type is overflowed
- Open
- links to