You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (Jira)" <ji...@apache.org> on 2022/06/06 22:16:00 UTC

[jira] [Resolved] (CALCITE-5147) Allow DATE, TIME, TIMESTAMP, INTERVAL literals in BigQuery dialect

     [ https://issues.apache.org/jira/browse/CALCITE-5147?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Julian Hyde resolved CALCITE-5147.
----------------------------------
    Resolution: Fixed

Fixed in [4659479|https://github.com/apache/calcite/commit/4659479a508461921c5b1e3e7c4d09cb745de33e]; thanks for the PR, [~wenruimeng]!

> Allow DATE, TIME, TIMESTAMP, INTERVAL literals in BigQuery dialect
> ------------------------------------------------------------------
>
>                 Key: CALCITE-5147
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5147
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Steven Talbot
>            Assignee: Wenrui Meng
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.31.0
>
>          Time Spent: 1h 40m
>  Remaining Estimate: 0h
>
> Parser configured with BigQuery dialect cannot parse timestamp literal.
> It looks like [CALCITE-4247|https://github.com/apache/calcite/commit/c1052b343724c4a95bcf25419b70bc6032e0846b#diff-e873041549333502af52ece8a1b34301ae5a059ff4719e9bddbaef48929e7047R7796] creates a special string literal token for BigQuery. But that means that (AFAICT) [Parser.jj|https://github.com/apache/calcite/blob/b9c2099ea92a575084b55a206efc5dd341c0df62/core/src/main/codegen/templates/Parser.jj#L4529] then does not find the expected token type after a TIMESTAMP to make a timestamp literal, so something as simple as
> {code:java}
> SqlParser.create("SELECT TIMESTAMP '2018-02-17 13:22:04'", BigQuerySqlDialect.DEFAULT.configureParser(SqlParser.config())).parseQuery() {code}
> fails.
> Probably most other places in Parser.jj that use the "<QUOTED_STRING>" token suffer from the same issue.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)