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

Calcite engine. Index on DATE/TIME/TIMESTAMP fields cannot be used

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • None
    • None

    Description

      For example:

      create table t(d date)
      create index my_index on t(d);
      insert into t values (date '2021-01-01')
      insert into t values (date '2021-01-02')
      select * from t where d = date '2021-01-01'
      

      Fails with:

      Caused by: class org.apache.ignite.internal.processors.query.IgniteSQLException: Failed to wrap object into H2 Value. java.lang.Integer cannot be cast to java.sql.Date
      	at org.apache.ignite.internal.processors.query.h2.index.keys.H2ValueWrapperMixin.wrapToValue(H2ValueWrapperMixin.java:37)
      	at org.apache.ignite.internal.processors.query.h2.index.keys.DateIndexKey.<init>(DateIndexKey.java:31)
      	at org.apache.ignite.internal.cache.query.index.sorted.keys.IndexKeyFactory.wrap(IndexKeyFactory.java:95)
      	at org.apache.ignite.internal.processors.query.calcite.exec.IndexScan.row2indexRow(IndexScan.java:173)
      	at org.apache.ignite.internal.processors.query.calcite.exec.IndexScan.row2indexRow(IndexScan.java:58)
      	at org.apache.ignite.internal.processors.query.calcite.exec.AbstractIndexScan.iterator(AbstractIndexScan.java:84)
      	at org.apache.ignite.internal.processors.query.calcite.exec.IndexScan.iterator(IndexScan.java:145)
      

      We should convert DATE/TIME/TIMESTAMP from internal presentation (see TypeUtils.fromInternal()) before creating IndexRow.

      Attachments

        Issue Links

          Activity

            People

              alex_pl Aleksey Plekhanov
              alex_pl Aleksey Plekhanov
              Votes:
              0 Vote for this issue
              Watchers:
              3 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 - 50m
                  50m