Mihai Budiu created CALCITE-7870:
------------------------------------

             Summary: RexSimplify removes some casts which change semantics
                 Key: CALCITE-7870
                 URL: https://issues.apache.org/jira/browse/CALCITE-7870
             Project: Calcite
          Issue Type: Bug
          Components: core
    Affects Versions: 1.42.0
            Reporter: Mihai Budiu
            Assignee: Mihai Budiu


RexSimplify will remove a cast from INT to DOUBLE in some circumstances where 
it shouldn't:

CAST(CAST(i AS DOUBLE) AS VARCHAR)

When i is 2, if the cast is not removed the result is 2.0. RexSimplify removes 
the cast, and the result becomes just 2.

There are other examples:

CAST(CAST(double AS VARCHAR(3))

When d is 6.666666 removing the cast gives 6.66666, but the result should be 
6.6.



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

Reply via email to