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

Norman Jordan commented on CALCITE-6585:
----------------------------------------

[~julianhyde]  I have posted a PR.

LOCAL_ZONE is still a static field since it is used to match the internal 
expectation of Calcite and does not relate to setting in DataContext.

TO_DATE and TO_TIMESTAMP are supposed to return long values.

TO_DATE - returns the number of days since epoch (in UTC)

TO_TIMESTAMP - returns the number of milliseconds since epoch (in UTC)

LOCAL_ZONE is used to convert a parsed date/time value back to the timezone 
that Calcite is expecting (UTC).

 

The long value may get converted back to a date/time elsewhere in Calcite (eg. 
to display the value) at which point the timezone from DataContext could be 
used.

> In the Postgres TO_CHAR function, improve caching
> -------------------------------------------------
>
>                 Key: CALCITE-6585
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6585
>             Project: Calcite
>          Issue Type: Improvement
>            Reporter: Julian Hyde
>            Assignee: Norman Jordan
>            Priority: Major
>              Labels: pull-request-available
>
> In the Postgres TO_CHAR function (and similar functions added in 
> CALCITE-6358), cache the formatter using the same technique used in 
> CALCITE-5914.
> Also pass the {{DataContext}} into the constructor of {{class 
> DataFormatFunction}}, so that it does not need to be passed to each call to 
> {{toCharPg}}.
> In {{DateFormatFunction}} obsolete static field {{LOCAL_ZONE}} and instead 
> populate a non-static field {{zoneId}} from the {{DataContext}} constructor 
> parameter.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to