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

[jira] [Created] (KYLIN-5043) support floor() or date_trunc() function for Kylin4

Congling Xia created KYLIN-5043:
-----------------------------------

             Summary: support floor() or date_trunc() function for Kylin4
                 Key: KYLIN-5043
                 URL: https://issues.apache.org/jira/browse/KYLIN-5043
             Project: Kylin
          Issue Type: Bug
          Components: Query Engine
    Affects Versions: v4.0.0-beta
            Reporter: Congling Xia
            Assignee: Congling Xia
         Attachments: image-2021-07-22-17-48-14-628.png

Dimension tables for date is seldom used in these days. Time function that can round datetimes to coarse grained granularities is very useful when writing queries in SQL.

Kylin 4 use SparkSQL to execute queries, but query SQL is parsed using Calcite.
 - in Calcite, a FLOOR function can round datetimes down
 - in Spark, the similar function is DATE_TRUNC 

but they cannot be transformed properly for now (fixed in Calcite 1.20, CALCITE-3072):
{code:java}
select 
  floor(PART_DT to year), count(1) 
from KYLIN_SALES 
group by 1; {code}

 !image-2021-07-22-17-48-14-628.png|width=1026,height=347!



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