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

ASF GitHub Bot updated CALCITE-3512:
------------------------------------
    Labels: pull-request-available  (was: )

> Support type cast from Time/TimeStamp to Integer/Long
> -----------------------------------------------------
>
>                 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
>
> 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)

Reply via email to