You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Wamsi Viswanath (JIRA)" <ji...@apache.org> on 2018/10/26 17:08:00 UTC

[jira] [Updated] (CALCITE-2643) CAST operations on microsecond and nanosecond columns getting down cast to TIMSTAMP(3)

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

Wamsi Viswanath updated CALCITE-2643:
-------------------------------------
    Description: 
Hello,

Calcite is automatically generating TIMSTAMP(3) casts even though we explicitly mention  TIMSTAMP(6) or  TIMSTAMP(9). Please see the below query and generated calcite:

 
{code:java}
explain calcite select cast(m_9 as timestamp(6)) from test;
-------------------------------------------------------------
Explanation
LogicalProject(EXPR$0=[CAST($19):TIMESTAMP(3)])
 EnumerableTableScan(table=[[mapd, test]])

select cast(m_9 as timestamp(6)) from test limit 2;
-----------------------------------------------------
2006-04-26 03:49:04.607
2006-04-26 03:49:04.607

explain calcite select cast(m_6 as timestamp(9)) from test limit 2;
---------------------------------------------------------------------------
Explanation
LogicalSort(fetch=[2])
 LogicalProject(EXPR$0=[CAST($18):TIMESTAMP(3)])
 EnumerableTableScan(table=[[mapd, test]])

{code}
I found there was a related issue regarding this and was mentioned that it was fixed in `1.13.0`, we are using `1.16.0` and the problem still persists.

https://jira.apache.org/jira/browse/CALCITE-1690 

  was:
Hello,

Calcite is automatically generating TIMSTAMP(3) casts even though we explicitly mention  TIMSTAMP(6) or  TIMSTAMP(9). Please see the below query and generated calcite:

 
{code:java}
explain calcite select cast(m_9 as timestamp(6)) from test;
-------------------------------------------------------------
Explanation
LogicalProject(EXPR$0=[CAST($19):TIMESTAMP(3)])
 EnumerableTableScan(table=[[mapd, test]])

select cast(m_9 as timestamp(6)) from test limit 2;
-----------------------------------------------------
2006-04-26 03:49:04.607
2006-04-26 03:49:04.607

explain calcite select cast(m_6 as timestamp(9)) from test limit 2;
---------------------------------------------------------------------------
Explanation
LogicalSort(fetch=[2])
 LogicalProject(EXPR$0=[CAST($18):TIMESTAMP(3)])
 EnumerableTableScan(table=[[mapd, test]])

{code}
I found there was a related issue regarding this and was mentioned that it was fixed in `1.13.0`, we are using `1.16.0` and the problem still persists.

 


> CAST operations on microsecond and nanosecond columns getting down cast to TIMSTAMP(3)
> --------------------------------------------------------------------------------------
>
>                 Key: CALCITE-2643
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2643
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.16.0
>            Reporter: Wamsi Viswanath
>            Assignee: Julian Hyde
>            Priority: Major
>
> Hello,
> Calcite is automatically generating TIMSTAMP(3) casts even though we explicitly mention  TIMSTAMP(6) or  TIMSTAMP(9). Please see the below query and generated calcite:
>  
> {code:java}
> explain calcite select cast(m_9 as timestamp(6)) from test;
> -------------------------------------------------------------
> Explanation
> LogicalProject(EXPR$0=[CAST($19):TIMESTAMP(3)])
>  EnumerableTableScan(table=[[mapd, test]])
> select cast(m_9 as timestamp(6)) from test limit 2;
> -----------------------------------------------------
> 2006-04-26 03:49:04.607
> 2006-04-26 03:49:04.607
> explain calcite select cast(m_6 as timestamp(9)) from test limit 2;
> ---------------------------------------------------------------------------
> Explanation
> LogicalSort(fetch=[2])
>  LogicalProject(EXPR$0=[CAST($18):TIMESTAMP(3)])
>  EnumerableTableScan(table=[[mapd, test]])
> {code}
> I found there was a related issue regarding this and was mentioned that it was fixed in `1.13.0`, we are using `1.16.0` and the problem still persists.
> https://jira.apache.org/jira/browse/CALCITE-1690 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)