Uploaded image for project: 'IMPALA'
  1. IMPALA
  2. IMPALA-8054

Implicit cast fails with {const INT} BETWEEN FLOAT and INT

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Done
    • Impala 3.2.0
    • Impala 4.3.0
    • Frontend
    • None

    Description

      In the following query the literal number 10 needs to be compared to two different types: INT and FLOAT, but Impala fails to make the implicit cast for the FLOAT.

      The predicates should be

      predicates: (cast(10 as float) >= col4) AND (10 <= col3)
      

      Test cases:

      sql> describe tab4
      +------+--------+---------+
      | name | type   | comment |
      +------+--------+---------+
      | pk   | int    |         |
      | col0 | int    |         |
      | col1 | float  |         |
      | col2 | string |         |
      | col3 | int    |         |
      | col4 | float  |         |
      | col5 | string |         |
      +------+--------+---------+
      
      sql> SELECT col0 FROM tab4 WHERE 10 BETWEEN col4 AND col3;
      ERROR: IllegalStateException: child 0 type: FLOAT child 1 type: DOUBLE
      
      sql> SELECT * FROM tab4 WHERE NULL NOT BETWEEN col3 AND col1;
      ERROR: IllegalStateException: child 0 type: INT child 1 type: DOUBLE
      
      sql> SELECT * FROM tab4 WHERE NULL BETWEEN CAST ( NULL AS INTEGER ) AND col4
      ERROR: IllegalStateException: child 0 type: DOUBLE child 1 type: INT
      
      

      Attachments

        Issue Links

          Activity

            People

              prozsa Peter Rozsa
              grahn Greg Rahn
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: