[
https://issues.apache.org/jira/browse/CALCITE-5360?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17631988#comment-17631988
]
TJ Banghart commented on CALCITE-5360:
--------------------------------------
Hey Julian, given that CALCITE-5155 has been merged, should these support the
same time frames + custom time frames as {{TIMESTAMPADD}} and
{{TIMESTAMPDIFF}} currently do? I'd say yes but BigQuery has a smaller set of
supported time frames:
https://cloud.google.com/bigquery/docs/reference/standard-sql/timestamp_functions#timestamp_add
If we want to support custom time frames for these functions we might need to
make small changes to the core parser. The default [{{IntervalQualifier()}}
|https://github.com/apache/calcite/blob/a0e119ea42def418957f214f539469f1aba76c18/core/src/main/codegen/templates/Parser.jj#L4846]
is not as flexible as the newly added
[{{TimeUnitOrName()}}|https://github.com/apache/calcite/blob/a0e119ea42def418957f214f539469f1aba76c18/core/src/main/codegen/templates/Parser.jj#L4983].
We could either parse {{TIMESTAMP_ADD}} and {{TIMESTAMP_DIFF}} as "special"
functions or change the default {{IntervalQualifier()}} to support
{{TimeUnitOrName()}} identifiers. There are of course other possibilities I
haven't thought about. Thank you!
> Implement BigQuery TIMESTAMP_ADD and TIMESTAMP_DIFF
> ---------------------------------------------------
>
> Key: CALCITE-5360
> URL: https://issues.apache.org/jira/browse/CALCITE-5360
> Project: Calcite
> Issue Type: Sub-task
> Components: core
> Reporter: TJ Banghart
> Priority: Major
>
> Calcite already supports TIMESTAMPADD and TIMESTAMPDIFF. We should try
> mapping the BQ style syntax to these already implemented functions.
> We did something similar for TIMESTAMP_TRUNC and TIME_TRUNC which
> conveniently mapped to FLOOR in
> [CALCITE-5269|https://issues.apache.org/jira/browse/CALCITE-5269]
--
This message was sent by Atlassian Jira
(v8.20.10#820010)