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 2020/06/26 17:16:00 UTC
[jira] [Resolved] (CALCITE-4089) In Babel, allow 'CAST(integer AS
DATE)' even though it is illegal in Calcite SQL
[ https://issues.apache.org/jira/browse/CALCITE-4089?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Julian Hyde resolved CALCITE-4089.
----------------------------------
Fix Version/s: 1.24.0
Resolution: Fixed
Fixed in [d839a57f|https://github.com/apache/calcite/commit/d839a57fc35a4bd46d1ef4d03e67e22db2e802d7].
> In Babel, allow 'CAST(integer AS DATE)' even though it is illegal in Calcite SQL
> --------------------------------------------------------------------------------
>
> Key: CALCITE-4089
> URL: https://issues.apache.org/jira/browse/CALCITE-4089
> Project: Calcite
> Issue Type: Bug
> Reporter: Julian Hyde
> Assignee: Julian Hyde
> Priority: Major
> Fix For: 1.24.0
>
>
> In Babel, allow 'CAST(integer AS DATE)', even though it is illegal in Calcite SQL (and standard SQL).
> Map it to valid standard SQL. BigQuery {{CAST(n AS DATE)}} is equivalent to Calcite {{DATE '1970-01-01' + n * INTERVAL '1' DAY}}.
> Also, add functions {{DATE_FROM_UNIX_DATE(INTEGER)}}, {{UNIX_SECONDS(TIMESTAMP)}}, {{UNIX_MILLIS(TIMESTAMP)}}, {{UNIX_MICROS(TIMESTAMP)}}, {{TIMESTAMP_SECONDS(BIGINT)}}, {{TIMESTAMP_MILLIS(BIGINT)}}, {{TIMESTAMP_MICROS(BIGINT)}} in the BigQuery library. They are well-named and well-specified, so they might be useful to people working in dialects besides BigQuery. {{DATE_FROM_UNIX_DATE(0)}} should return {{DATE '1970-01-01'}}.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)