[ 
https://issues.apache.org/jira/browse/IGNITE-16905?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Pavel Pereslegin resolved IGNITE-16905.
---------------------------------------
    Resolution: Duplicate

> Sql. ClassCastException when deserialising TIMESTAMP literal
> ------------------------------------------------------------
>
>                 Key: IGNITE-16905
>                 URL: https://issues.apache.org/jira/browse/IGNITE-16905
>             Project: Ignite
>          Issue Type: Bug
>          Components: sql
>            Reporter: Konstantin Orlov
>            Assignee: Pavel Pereslegin
>            Priority: Major
>              Labels: calcite, ignite-3
>
> The problem appears to be caused by an inconsistency of RelReader and 
> RexBuilder: RelReader diserializes every integer value as a value of type 
> Integer, but the RexBuilder assumes that for TIMESTAMP literal a value of 
> type Long will be passed, and make the explicit cast:
> {code:java}
> // RexBuilder#clean(Object, RelDataType)
> case TIMESTAMP:
>   if (o instanceof TimestampString) {
>     return o;
>   } else if (o instanceof Calendar) {
>     if (!((Calendar) o).getTimeZone().equals(DateTimeUtils.UTC_ZONE)) {
>       throw new AssertionError();
>     }
>     return TimestampString.fromCalendarFields((Calendar) o);
>   } else {
>     return TimestampString.fromMillisSinceEpoch((Long) o);
>   } {code}
>  
> Here is a stack trace:
> {noformat}
> Caused by: java.lang.ClassCastException: class java.lang.Integer cannot be 
> cast to class java.lang.Long (java.lang.Integer and java.lang.Long are in 
> module java.base of loader 'bootstrap')
>       at org.apache.calcite.rex.RexBuilder.clean(RexBuilder.java:1780)
>       at org.apache.calcite.rex.RexBuilder.makeLiteral(RexBuilder.java:1558)
>       at org.apache.calcite.rex.RexBuilder.makeLiteral(RexBuilder.java:1520)
>       at 
> org.apache.ignite.internal.sql.engine.externalize.RelJson.toRex(RelJson.java:759)
>       at 
> org.apache.ignite.internal.sql.engine.externalize.RelJsonReader$RelInputImpl.getTuple(RelJsonReader.java:367)
>       at 
> org.apache.ignite.internal.sql.engine.externalize.RelJsonReader$RelInputImpl.getTuples(RelJsonReader.java:347)
>       ... 24 more {noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to