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/21 01:43:00 UTC

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

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

Danny Chen commented on CALCITE-3512:
-------------------------------------

Reviewing now ~

> 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
>          Time Spent: 2h
>  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)