You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by Soma Mondal <ma...@gmail.com> on 2020/02/20 11:02:33 UTC

Date and time formats in the standard operator table

Hi,


We are seeing that in many dialects, there is support for formatting dates,
times and timestamps (please see THIS
<https://docs.google.com/spreadsheets/d/19x0hK3LcHxhdcx-Q7j1i8jZOoxRoUJjUTp3VxeWt4Ak/edit?usp=sharing>
link for information about SqlServer, MySql, Oracle, Teradata).


In the current standard operator table, we don't see any operator that does
such a thing. We were thinking that we should add a new standard operator
which follows the formatting standard followed by SimpleDateFormat.java


Can you please share your inputs regarding this? Should we go ahead and do
so or do you have other thoughts regarding this?


*Regards,*
*Soma Mondal*

Re: Date and time formats in the standard operator table

Posted by Danny Chan <yu...@gmail.com>.
Maybe the format for CAST in SQL 2016 [1] is what you need, it’s not implemented yet.

[1] https://issues.apache.org/jira/browse/CALCITE-2980

Best,
Danny Chan
在 2020年2月20日 +0800 PM7:02,Soma Mondal <ma...@gmail.com>,写道:
> Hi,
>
>
> We are seeing that in many dialects, there is support for formatting dates,
> times and timestamps (please see THIS
> <https://docs.google.com/spreadsheets/d/19x0hK3LcHxhdcx-Q7j1i8jZOoxRoUJjUTp3VxeWt4Ak/edit?usp=sharing>
> link for information about SqlServer, MySql, Oracle, Teradata).
>
>
> In the current standard operator table, we don't see any operator that does
> such a thing. We were thinking that we should add a new standard operator
> which follows the formatting standard followed by SimpleDateFormat.java
>
>
> Can you please share your inputs regarding this? Should we go ahead and do
> so or do you have other thoughts regarding this?
>
>
> *Regards,*
> *Soma Mondal*

Re: Date and time formats in the standard operator table

Posted by Julian Hyde <jh...@apache.org>.
I don’t think there’s a standard, and we wouldn’t be solving the problem if we create our own “standard”. (See https://xkcd.com/927/ <https://xkcd.com/927/>.) So it’s better to implement everyone else’s “standard” and let our users choose.

It would be a great start if someone were to contribute an implementation of Oracle’s TO_CHAR function that works for number, date, time, timestamp, interval.

It’s one of a long list of functions in https://issues.apache.org/jira/browse/CALCITE-759 <https://issues.apache.org/jira/browse/CALCITE-759>. 

(Not to play favorites - we’d be happy to also accept implementations of every other database’s TO_CHAR function, or equivalent.)

Julian


> On Feb 20, 2020, at 3:02 AM, Soma Mondal <ma...@gmail.com> wrote:
> 
> Hi,
> 
> 
> We are seeing that in many dialects, there is support for formatting dates,
> times and timestamps (please see THIS
> <https://docs.google.com/spreadsheets/d/19x0hK3LcHxhdcx-Q7j1i8jZOoxRoUJjUTp3VxeWt4Ak/edit?usp=sharing>
> link for information about SqlServer, MySql, Oracle, Teradata).
> 
> 
> In the current standard operator table, we don't see any operator that does
> such a thing. We were thinking that we should add a new standard operator
> which follows the formatting standard followed by SimpleDateFormat.java
> 
> 
> Can you please share your inputs regarding this? Should we go ahead and do
> so or do you have other thoughts regarding this?
> 
> 
> *Regards,*
> *Soma Mondal*