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

Julian Hyde commented on CALCITE-759:
-------------------------------------

Thanks for doing this analysis. Very useful.

Of the ones that are supported by multiple databases (DATEPART, DAY, LAST_DAY, 
TO_CHAR, TO_TIMESTAMP), are their specifications largely the same?

WEEKDAY (Mon=0, Sun=6) seems to occur in MySQL but not in ODBC or any other 
database I could find. So we should use MySQL as the standard. Frankly, low 
priority, because WEEKDAY\(x) == MOD(EXTRACT(DOW FROM x) + 1, 7).

If there is a conflict between ODBC and another database, the ODBC semantics 
should only apply if they call using ODBC function syntax: {code}{fn 
FUNCTION_NAME(arg, ...)}{code}

I think the high priority ones are the TO_xxx functions (e.g. TO_CHAR, 
TO_TIMESTAMP). Anything that involves formatting or parsing is too complicated 
to achieve using the existing functions.

What do other people think are the important functions to add to Calcite?

> Add DayOfWeek and other missing date/time functions
> ---------------------------------------------------
>
>                 Key: CALCITE-759
>                 URL: https://issues.apache.org/jira/browse/CALCITE-759
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Julian Hyde
>            Assignee: Julian Hyde
>            Priority: Major
>              Labels: dialect, newbie
>
> Calcite implements EXTRACT, FLOOR, CEIL, CAST, +, - on date/time values and 
> much can be accomplished with these. But there are other useful functions in 
> other databases.
> For example MySQL has DayOfWeek. See 
> https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html. It is 
> tricky to achieve the same in Calcite (you'd need to subtract the epoch and 
> take the interval modulo 7).
> We need to review the date/time functions in MySQL, Postgres and Oracle, and 
> add functions to ensure that you can accomplish the same things in Calcite 
> fairly easily.



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

Reply via email to