[ 
https://issues.apache.org/jira/browse/CALCITE-6169?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Mihai Budiu updated CALCITE-6169:
---------------------------------
    Fix Version/s: 1.37.0

> EnumUtils.convert does not implement the correct SQL cast semantics
> -------------------------------------------------------------------
>
>                 Key: CALCITE-6169
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6169
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.36.0
>            Reporter: Mihai Budiu
>            Assignee: Mihai Budiu
>            Priority: Major
>             Fix For: 1.37.0
>
>
> 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?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to