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

[jira] [Comment Edited] (CALCITE-5761) DATE_TRUNC compile-time evaluation produces wrong results

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

Tanner Clary edited comment on CALCITE-5761 at 6/7/23 4:25 PM:
---------------------------------------------------------------

[~mbudiu] Yes I agree, but I think it's important to decide before any implementation which of those two paths is correct. There are other cases where Calcite's implementation of BQ functions contains more functionality than BQ itself. Also, if the issue lies in the DateTimeUtils class I linked, that is apart of the Calcite-Avatica project. Hope this helps!


was (Author: JIRAUSER298151):
[~mbudiu] Yes I agree, but I think it's important to decide before any implementation which of those two paths is correct.

> DATE_TRUNC compile-time evaluation produces wrong results
> ---------------------------------------------------------
>
>                 Key: CALCITE-5761
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5761
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.34.0
>            Reporter: Mihai Budiu
>            Priority: Minor
>
> Adding the following 3 tests to SqlOperatorTest.testDateTrunc produces assertion failures.
> f.checkScalar("date_trunc(date '2015-02-19', decade)",
>         "2010-01-01", "DATE NOT NULL");
>     f.checkScalar("date_trunc(date '2015-02-19', century)",
>         "2001-01-01", "DATE NOT NULL");
>     f.checkScalar("date_trunc(date '2015-02-19', millennium)",
>         "1001-01-01", "DATE NOT NULL");
> Results produced:
> Query: values (date_trunc(date '2015-02-19', decade))
> Expected: is "2010-01-01"
>      but: was "2015-01-05"
> Query: values (date_trunc(date '2015-02-19', century))
> Expected: is "2001-01-01"
>      but: was "2012-09-17"
> Query: values (date_trunc(date '2015-02-19', millennium))
> Expected: is "1001-01-01"
>      but: was "2002-11-09"



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