You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Aleksey Plekhanov (Jira)" <ji...@apache.org> on 2021/12/08 07:16:00 UTC

[jira] [Created] (IGNITE-16077) Calcite engine. Index on DATE/TIME/TIMESTAMP fields cannot be used

Aleksey Plekhanov created IGNITE-16077:
------------------------------------------

             Summary: Calcite engine. Index on DATE/TIME/TIMESTAMP fields cannot be used
                 Key: IGNITE-16077
                 URL: https://issues.apache.org/jira/browse/IGNITE-16077
             Project: Ignite
          Issue Type: Bug
            Reporter: Aleksey Plekhanov


For example:

{noformat}
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'
{noformat}
Fails with:
{noformat}
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)
{noformat}
We should convert DATE/TIME/TIMESTAMP from internal presentation (see {{TypeUtils.fromInternal()}}) before creating {{IndexRow}}.
 



--
This message was sent by Atlassian Jira
(v8.20.1#820001)