You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ma...@apache.org on 2018/05/14 19:12:03 UTC
[incubator-superset] branch master updated: Update Apache Kylin
dbengine with supported week/quarter grains (#4965)
This is an automated email from the ASF dual-hosted git repository.
maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
The following commit(s) were added to refs/heads/master by this push:
new 7a4a89b Update Apache Kylin dbengine with supported week/quarter grains (#4965)
7a4a89b is described below
commit 7a4a89b1959b72295abf986bc4cf330059682105
Author: Yongjie Zhao <yo...@gmail.com>
AuthorDate: Tue May 15 03:11:59 2018 +0800
Update Apache Kylin dbengine with supported week/quarter grains (#4965)
---
superset/db_engine_specs.py | 32 ++++++++++++++++++++++++++------
1 file changed, 26 insertions(+), 6 deletions(-)
diff --git a/superset/db_engine_specs.py b/superset/db_engine_specs.py
index 733588a..eea0668 100644
--- a/superset/db_engine_specs.py
+++ b/superset/db_engine_specs.py
@@ -1338,12 +1338,32 @@ class KylinEngineSpec(BaseEngineSpec):
time_grains = (
Grain('Time Column', _('Time Column'), '{col}', None),
- Grain('second', _('second'), 'SECOND({col})', 'PT1S'),
- Grain('minute', _('minute'), 'MINUTE({col})', 'PT1M'),
- Grain('hour', _('hour'), 'HOUR({col})', 'PT1H'),
- Grain('month', _('month'), 'MONTH({col})', 'P1M'),
- Grain('quarter', _('quarter'), 'QUARTER({col})', 'P0.25Y'),
- Grain('year', _('year'), 'YEAR({col})', 'P1Y'),
+ Grain('second', _('second'),
+ 'CAST(FLOOR(CAST({col} AS TIMESTAMP) TO SECOND) AS TIMESTAMP)',
+ 'PT1S'),
+ Grain('minute', _('minute'),
+ 'CAST(FLOOR(CAST({col} AS TIMESTAMP) TO MINUTE) AS TIMESTAMP)',
+ 'PT1M'),
+ Grain('hour', _('hour'),
+ 'CAST(FLOOR(CAST({col} AS TIMESTAMP) TO HOUR) AS TIMESTAMP)',
+ 'PT1H'),
+ Grain('day', _('day'),
+ 'CAST(FLOOR(CAST({col} AS TIMESTAMP) TO DAY) AS DATE)',
+ 'P1D'),
+ Grain('week', _('week'),
+ 'CAST(TIMESTAMPADD(WEEK, WEEK(CAST({col} AS DATE)) - 1, \
+ FLOOR(CAST({col} AS TIMESTAMP) TO YEAR)) AS DATE)',
+ 'P1W'),
+ Grain('month', _('month'),
+ 'CAST(FLOOR(CAST({col} AS TIMESTAMP) TO MONTH) AS DATE)',
+ 'P1M'),
+ Grain('quarter', _('quarter'),
+ 'CAST(TIMESTAMPADD(QUARTER, QUARTER(CAST({col} AS DATE)) - 1, \
+ FLOOR(CAST({col} AS TIMESTAMP) TO YEAR)) AS DATE)',
+ 'P0.25Y'),
+ Grain('year', _('year'),
+ 'CAST(FLOOR(CAST({col} AS TIMESTAMP) TO YEAR) AS DATE)',
+ 'P1Y'),
)
@classmethod
--
To stop receiving notification emails like this one, please contact
maximebeauchemin@apache.org.