You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "sunjincheng (JIRA)" <ji...@apache.org> on 2017/06/03 06:19:04 UTC
[jira] [Comment Edited] (CALCITE-1827) Add DATEADD as build-in
scalar function
[ https://issues.apache.org/jira/browse/CALCITE-1827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16035863#comment-16035863 ]
sunjincheng edited comment on CALCITE-1827 at 6/3/17 6:18 AM:
--------------------------------------------------------------
Hi [~julianhyde] Thanks for the explanation. I found the {{SqlTimestampAddFunction}} in source code, And see the test case. You are right we supported to add {{TIMESTAMPADD}} and {{TIMESTAMPDIFF}} to [reference.md|http://calcite.apache.org/docs/reference.html#datetime-functions].
I have opened a PR. I appreciated if you can review the PR. [https://github.com/apache/calcite/pull/466|https://github.com/apache/calcite/pull/466]
Thanks,
SunJincheng
was (Author: sunjincheng121):
Hi [~julianhyde] Thanks for the explanation. I found the {{SqlTimestampAddFunction}} in source code, And see the test case. Your right we supported to add {{TIMESTAMPADD}} and {{TIMESTAMPDIFF}} to [reference.md|http://calcite.apache.org/docs/reference.html#datetime-functions].
I have opened a PR. I appreciated if you can review the PR. [https://github.com/apache/calcite/pull/466|https://github.com/apache/calcite/pull/466]
Thanks,
SunJincheng
> Add DATEADD as build-in scalar function
> ---------------------------------------
>
> Key: CALCITE-1827
> URL: https://issues.apache.org/jira/browse/CALCITE-1827
> Project: Calcite
> Issue Type: New Feature
> Components: core
> Reporter: sunjincheng
> Assignee: sunjincheng
>
> Syntax
> DATEADD (datepart , number , date )
> -datepart
> Is the part of date to which an integer number is added.
> -number
> Is an expression that can be resolved to an int that is added to a datepart of date
> -date
> Is an expression that can be resolved to a time.
> Example
> SELECT DATEADD(month, 1, '2017-05-31') from tab; --> 2017-06-30 00:00:00.000
> MSSQL:
> https://docs.microsoft.com/en-us/sql/t-sql/functions/dateadd-transact-sql
> MySql:
> https://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html#function_date-add
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)