[
https://issues.apache.org/jira/browse/CALCITE-3512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16976775#comment-16976775
]
Julian Hyde commented on CALCITE-3512:
--------------------------------------
Please fix the description before this is committed. You imply that the query
is trying to cast a SQL TIMESTAMP or TIME value to a SQL INTEGER or BIGINT
value, and that is not the case. Describe the bug from the perspective of the
SQL user. There are no INTEGER or BIGINT values in that query.
> 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
> Time Spent: 20m
> 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)