You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by Julian Hyde <jh...@apache.org> on 2015/06/11 18:48:21 UTC

Missing date-time functions

What important date-time functions are missing from Calcite? Calcite has
quite a few functions, including:
* EXTRACT(<time-unit> FROM <date-time>)
* FLOOR(<date-time> TO <time-unit>)
* CEIL(<date-time> TO <time-unit>)
* CAST(<date-time> TO <data-type>)
* <date-time> + <interval>
* <date-time> - <interval>
* (<date-time> - <date-time>) <time-unit> [ TO <time-unit> ]

But there are gaps. For instances, there doesn't seem to be a way to
convert a time to day of the week. So, it would be useful if we implemented
DAYOFWEEK a la MySQL [
https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html ].

What other functions are needed?

I'm not interested in implementing every possible date-time function in
every database. (We don't need DATEDIFF, because we have interval
arithmetic.) I just want to make sure that there is a way to achieve all of
the common operations.

Julian

Re: Missing date-time functions

Posted by Julian Hyde <jh...@apache.org>.
I have logged https://issues.apache.org/jira/browse/CALCITE-759 to track this.

On Jun 11, 2015, at 9:48 AM, Julian Hyde <jh...@apache.org> wrote:

> What important date-time functions are missing from Calcite? Calcite has quite a few functions, including:
> * EXTRACT(<time-unit> FROM <date-time>)
> * FLOOR(<date-time> TO <time-unit>)
> * CEIL(<date-time> TO <time-unit>)
> * CAST(<date-time> TO <data-type>)
> * <date-time> + <interval>
> * <date-time> - <interval>
> * (<date-time> - <date-time>) <time-unit> [ TO <time-unit> ]
> 
> But there are gaps. For instances, there doesn't seem to be a way to convert a time to day of the week. So, it would be useful if we implemented DAYOFWEEK a la MySQL [ https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html ].
> 
> What other functions are needed?
> 
> I'm not interested in implementing every possible date-time function in every database. (We don't need DATEDIFF, because we have interval arithmetic.) I just want to make sure that there is a way to achieve all of the common operations.
> 
> Julian
>