You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Danny Chen (Jira)" <ji...@apache.org> on 2019/11/27 07:19:00 UTC

[jira] [Resolved] (CALCITE-3512) Query fails when comparing Time/TimeStamp types

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

Danny Chen resolved CALCITE-3512.
---------------------------------
    Fix Version/s: 1.22.0
       Resolution: Fixed

Fixed in [33157f4|https://github.com/apache/calcite/commit/33157f42f9ec7779b53b807db7b5066c1314fb6e], thanks for your PR, [~donnyzone] !

> Query fails when comparing Time/TimeStamp types
> -----------------------------------------------
>
>                 Key: CALCITE-3512
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3512
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.21.0
>            Reporter: Feng Zhu
>            Assignee: Feng Zhu
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.22.0
>
>          Time Spent: 5h 50m
>  Remaining Estimate: 0h
>
> A similar test like *ReflectiveSchemaTest#testDateCanCompare*
> {code:java}
> @Test public void testDateCanCompare2() {
>   final String sql = "select a.v1, a.v2\n"
>       + "from (select \"sqlTime\" v1, \"sqlTimestamp\" v2\n"
>       + "  from \"s\".\"everyTypes\" "
>       + "  group by \"sqlTime\", \"sqlTimestamp\") a,"
>       + "    (select \"sqlTime\" v1, \"sqlTimestamp\" v2\n"
>       + "  from \"s\".\"everyTypes\"\n"
>       + "  group by \"sqlTime\", \"sqlTimestamp\") b\n"
>       + "where a.v1 >= b.v1 and a.v2 >= b.v2\n"
>       + "group by a.v1, a.v2";
>   CalciteAssert.that()
>       .withSchema("s", CATCHALL)
>       .query(sql)
>       .returnsUnordered("V1=00:00:00; V2=1970-01-01 00:00:00");
> }{code}
> The query fails with exception:
> {code:java}
> Caused by: java.lang.ClassCastException: java.sql.Time cannot be cast to java.lang.Integer
>  at Baz$10$1.moveNext(Unknown Source)
>  at org.apache.calcite.linq4j.EnumerableDefaults.groupBy_(EnumerableDefaults.java:825)
>  at org.apache.calcite.linq4j.EnumerableDefaults.groupBy(EnumerableDefaults.java:764)
>  at org.apache.calcite.linq4j.DefaultEnumerable.groupBy(DefaultEnumerable.java:308)
>  at Baz.bind(Unknown Source){code}
> We also need to support type cast from *Time/TimeStamp* to *Integer/Long*



--
This message was sent by Atlassian Jira
(v8.3.4#803005)