You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "TJ Banghart (Jira)" <ji...@apache.org> on 2023/03/29 05:00:00 UTC

[jira] [Comment Edited] (CALCITE-5616) Allow unparsing of SqlIntervalQualifier in EXTRACT to be overridden by dialects

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

TJ Banghart edited comment on CALCITE-5616 at 3/29/23 4:59 AM:
---------------------------------------------------------------

[~tanclary] - this might relate to your work on CALCITE-5449


was (Author: tjbanghart):
[~tanclary] - this might relate to some of work on CALCITE-5449

> Allow unparsing of SqlIntervalQualifier in EXTRACT to be overridden by dialects
> -------------------------------------------------------------------------------
>
>                 Key: CALCITE-5616
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5616
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>            Reporter: TJ Banghart
>            Priority: Minor
>
> In {{SqlExtractFunction#unparse}}, the first operand is passed to  {{SqlIntervalQualifier.asIdentifier}} which returns a {{SqlIdentifier}} [if the operand is a {{SqlIntervalQualifier}}|https://github.com/apache/calcite/blob/5c7be55ffee836366dcc7fefb6adfc0b8c47465f/core/src/main/java/org/apache/calcite/sql/SqlIntervalQualifier.java#L1366-L1370]. 
> {{SqlIdentifier#unparse}} is handled by [{{SqlUtil#unparseSqlIdentifierSyntax}}|https://github.com/apache/calcite/blob/5c7be55ffee836366dcc7fefb6adfc0b8c47465f/core/src/main/java/org/apache/calcite/sql/SqlUtil.java#L384-L412] which has no dialect context.
> We should unparse these interval identifiers in the target dialect using the [existing {{SqlDialect#unparseSqlIntervalQualifier}} method|https://github.com/apache/calcite/blob/5c7be55ffee836366dcc7fefb6adfc0b8c47465f/core/src/main/java/org/apache/calcite/sql/SqlDialect.java#L492-L538]. This would help prevent errors when unparsing interval identifiers for some dialects. 
> For example, BigQuery uses {{DAYOFWEEK}} rather than {{DOW}} but there is currently no way to override this in {{BigQuerySqlDialect}}.



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