You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Remus Rusanu (JIRA)" <ji...@apache.org> on 2017/03/13 16:59:41 UTC

[jira] [Commented] (CALCITE-1690) Calcite timestamp literals cannot express precision above millisecond, TIMESTAMP(3)

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

Remus Rusanu commented on CALCITE-1690:
---------------------------------------

Any opinion on how to address this? Supporting ANSI TIMESTMAP(9) would require that Calcite changes the internal representation. I'm guessing {{java.time.*}} types are not an option since it would make JDK 1.8 a hard requirement. My frst instinct is to give {{java.sql.Timestamp}} a try as internal Calcite representation for TIMESTMAP.

> Calcite timestamp literals cannot express precision above millisecond, TIMESTAMP(3)
> -----------------------------------------------------------------------------------
>
>                 Key: CALCITE-1690
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1690
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Remus Rusanu
>            Assignee: Remus Rusanu
>
> {{RexBuilder.makeTimestampLiteral}} accepts the TS as a Java Calendar instance. Calendar type has only ms precision, thus types like {{TIMESTAMP(9)}} cannot be represented.
> This results in incorrect results in Hive due to constant reduction:
> {noformat}
> hive> explain select c17 from testjdbcdriverdatatypetbl where c17='2012-04-22 09:00:00.123456789';
> OK
> Plan optimized by CBO.
> Stage-0
>   Fetch Operator
>     limit:-1
>     Select Operator [SEL_2]
>       Output:["_col0"]
>       Filter Operator [FIL_4]
>         predicate:(c17 = 2012-04-22 09:00:00.123)
>         TableScan [TS_0]
>           Output:["c17"]
> hive> select c17 from testjdbcdriverdatatypetbl where c17='2012-04-22 09:00:00.123456789';
> OK
> Time taken: 0.687 seconds
> hive> set hive.cbo.enable=false;
> hive> explain select c17 from testjdbcdriverdatatypetbl where c17='2012-04-22 09:00:00.123456789';
> OK
> Stage-0
>   Fetch Operator
>     limit:-1
>     Select Operator [SEL_2]
>       Output:["_col0"]
>       Filter Operator [FIL_4]
>         predicate:(c17 = '2012-04-22 09:00:00.123456789')
>         TableScan [TS_0]
>           Output:["c17"]
> hive> select c17 from testjdbcdriverdatatypetbl where c17='2012-04-22 09:00:00.123456789';
> OK
> 2012-04-22 09:00:00.123
> {noformat}
> Note how with CBO enabled the qualified row is missed. The plan shows that the constant was truncated to ms.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)