You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Mihai Budiu (Jira)" <ji...@apache.org> on 2023/01/26 20:51:00 UTC
[jira] [Commented] (CALCITE-759) Add DayOfWeek and other missing date/time functions
[ https://issues.apache.org/jira/browse/CALCITE-759?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17681119#comment-17681119 ]
Mihai Budiu commented on CALCITE-759:
-------------------------------------
I have a related question about the evaluation of expressions such as EXTRACT(DOW FROM DATE '2020-08-16')
Calcite optimizes this at compile time to produce the result 1, using DateTimeUtils.julianExtract.
However, the semantics of DOW should depend on the dialect of SQL used; Postgres returns 0 for this expression.
I could not figure out how to produce a result that is influenced by the SQL dialect compiled. Is it possible?
> 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
> Components: babel
> Reporter: 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
(v8.20.10#820010)