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

Julian Hyde commented on CALCITE-5180:
--------------------------------------

[~wnoble], I reviewed your [PR 
2973|https://github.com/apache/calcite/pull/2973] and left a few comments. But 
there's a bigger concern about the {{DATE}}, {{TIMESTAMP}}, {{TIME}} and 
{{DATETIME}} functions, namely data types.

I think that the default {{TIMESTAMP}} function should return a value whose 
type is a Calcite {{TIMESTAMP}}, and similarly the other functions. But if 
you're running in extreme BQ compatibility mode (EBQC mode), you will want the 
{{TIMESTAMP}} function to return a value of Calcite type {{TIMESTAMP WITH LOCAL 
TIMEZONE}}, which in EBQC mode is aliased to a type called {{TIMESTAMP}}.

The cleanest implementation is to build library functions called {{TIMESTAMP}}, 
{{TIME}}, {{DATE}}, {{TIMESTAMP_WITH_LOCAL_TIMEZONE}} that return the same 
Calcite types as their names. But in EBQC mode, create {{DATETIME}}, {{TIME}}, 
{{DATE}}, {{TIMESTAMP}} functions that map onto the aforementioned functions. 
Sorry if that's confusing. But I fear that anything else might be more 
confusing.

> Implement BigQuery functions for DATE, TIME, TIMESTAMP, DATETIME
> ----------------------------------------------------------------
>
>                 Key: CALCITE-5180
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5180
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Julian Hyde
>            Assignee: Will Noble
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> Implement missing BigQuery functions for DATE, TIME, TIMESTAMP, DATETIME.
> Functions include:
> * CURRENT_DATE, CURRENT_DATETIME, CURRENT_TIME with timezone;
> * EXTRACT with time unit values WEEK(weekday), DATE, TIME;
> * various DATE, TIME, TIMESTAMP, DATETIME constructor functions;
> * DATE_ADD, DATETIME_ADD, TIME_ADD, TIMESTAMP_ADD;
> * DATE_SUB, DATETIME_SUB, TIME_SUB, TIMESTAMP_SUB;
> * DATE_DIFF, DATETIME_DIFF, TIME_DIFF, TIMESTAMP_DIFF;
> * DATE_TRUNC, DATETIME_TRUNC, TIME_TRUNC, TIMESTAMP_TRUNC;
> * LAST_DAY;
> * FORMAT_DATE, FORMAT_DATETIME, FORMAT_TIME, FORMAT_TIMESTAMP; 
> * PARSE_DATE, PARSE_DATETIME, PARSE_TIME, PARSE_TIMESTAMP. 
> The following functions are already implemented: CURRENT_DATETME, 
> DATE(string), DATE_FROM_UNIX_DATE, TIMESTAMP_MICROS, TIMESTAMP_MILLIS, 
> TIMESTAMP_SECONDS, UNIX_MICROS, UNIX_MILLIS, UNIX_SECONDS, UNIX_DATE.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to