Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-4806

Lossy CAST is incorrectly simplified

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.38.0
    • None

    Description

      the sql is following:

      // code placeholder
      select cast(1.1 as int) = cast (1 as int)

      In SQLite the result is 1 and in postgreSQL the result is true.

      But in calcite the result is false.

      The bug is in RexSimplify and 1.1 and 1 are all converted to java.lang.Comparable, and 1.1 doesn't equal to 1. It ignores the source data type. The literal 1.1 should be cast to 1(int) first.

      Attachments

        Issue Links

          Activity

            People

              nobigo xiong duan
              xuyangzhong xuyang
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: