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 12:57:00 UTC

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

    [ https://issues.apache.org/jira/browse/IGNITE-16077?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17455223#comment-17455223 ] 

Aleksey Plekhanov commented on IGNITE-16077:
--------------------------------------------

[~korlov], [~tledkov-gridgain], [~zstan], can you please have a look at the patch?

> 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
>            Assignee: Aleksey Plekhanov
>            Priority: Major
>              Labels: calcite2-required, calcite3-required
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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)