You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kylin.apache.org by "Congling Xia (Jira)" <ji...@apache.org> on 2021/07/22 06:40:00 UTC

[jira] [Closed] (KYLIN-5042) floor function return wrong result for date type

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

Congling Xia closed KYLIN-5042.
-------------------------------
    Fix Version/s:     (was: Future)
       Resolution: Not A Problem

It is not a problem since FLOOR works for numeric and datetime inputs, or, maybe, calcite should not accept date or time as a valid function parameter. The right way to "floor" a date could beĀ 
{code:java}
floor( cast(<some_day> as timestamp) to <some_time_unit> ){code}

> floor function return wrong result for date type
> ------------------------------------------------
>
>                 Key: KYLIN-5042
>                 URL: https://issues.apache.org/jira/browse/KYLIN-5042
>             Project: Kylin
>          Issue Type: Bug
>    Affects Versions: v3.1.2
>            Reporter: Congling Xia
>            Priority: Major
>
> floor function return wrong result for date type, for example:
> {code:java}
> select 
>   floor(current_date to YEAR), 
>   floor(cast('2021-07-01' AS DATE) to YEAR), 
>   floor(cast('2021-07-01' AS TIMESTAMP) to YEAR)
> {code}
> the result is:
> {code:java}
> EXPR$0      EXPR$1      EXPR$2
> 1970-01-01  1970-01-01  2021-01-01 00:00:00
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)