Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-19976

Sql: ClassCastException when trying to select from indexed smallint column

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.0, 3.0.0-beta1
    • 3.0
    • sql

    Description

      Steps to reproduce:

      sql-cli> create table tt(id INTEGER not null, field_1 TINYINT, field_2 SMALLINT, primary key (id));
      Updated 0 rows.
      sql-cli> SELECT * FROM tt WHERE field_2 = 50;
      ╔════╤═════════╤═════════╗
      ║ ID │ FIELD_1 │ FIELD_2 ║
      ╠════╧═════════╧═════════╣
      ║ (empty)                ║
      ╚════════════════════════╝
      
      -- select over field_2 works fine until we create an index on it!
      
      sql-cli> CREATE INDEX tt_idx ON tt (field_2);
      Updated 0 rows.
      sql-cli> SELECT * FROM tt WHERE field_2 = 50;
      SQL query execution error
      Exception while executing query [query=SELECT * FROM tt WHERE field_2 = 50;]. Error message:Query remote fragment execution failed: nodeName=defaultNode, queryId=15a68600-41bc-46c5-b20d-7a96aad15477, fragmentId=4, originalMessage=class java.lang.Integer cannot be cast to class java.lang.Short (java.lang.Integer and java.lang.Short are in module java.base of loader 'bootstrap')
      

      This doesn't look good. A created index must not cause casting exception.

      Reproduced on commit `fef7a24c2a029cac720d2fea3815c2a70a86b72f` (2023-07-12)

      Attachments

        Issue Links

          Activity

            People

              mzhuravkov Maksim Zhuravkov
              akhitrin Andrey Khitrin
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h
                  1h