This is an automated email from the ASF dual-hosted git repository. villebro 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 300b2bb fix: Fixed bug for issue #9967 (#10269) 300b2bb is described below commit 300b2bbf2d74e57a4eff5e8f43e03b87a0e173c0 Author: Nilanjan Sarkar <nj-...@users.noreply.github.com> AuthorDate: Thu Jul 9 18:45:07 2020 +0530 fix: Fixed bug for issue #9967 (#10269) * Added formatted file setup.cfg * lint Co-authored-by: Nilanjan1.Sarkar <nilanjan1.sar...@ril.com> --- superset/db_engine_specs/hive.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/superset/db_engine_specs/hive.py b/superset/db_engine_specs/hive.py index 478a65e..bb2c43c 100644 --- a/superset/db_engine_specs/hive.py +++ b/superset/db_engine_specs/hive.py @@ -56,6 +56,20 @@ class HiveEngineSpec(PrestoEngineSpec): engine = "hive" max_column_name_length = 767 + # pylint: disable=line-too-long + _time_grain_expressions = { + None: "{col}", + "PT1S": "from_unixtime(unix_timestamp({col}), 'yyyy-MM-dd HH:mm:ss')", + "PT1M": "from_unixtime(unix_timestamp({col}), 'yyyy-MM-dd HH:mm:00')", + "PT1H": "from_unixtime(unix_timestamp({col}), 'yyyy-MM-dd HH:00:00')", + "P1D": "from_unixtime(unix_timestamp({col}), 'yyyy-MM-dd 00:00:00')", + "P1W": "date_format(date_sub({col}, CAST(7-from_unixtime(unix_timestamp({col}),'u') as int)), 'yyyy-MM-dd 00:00:00')", + "P1M": "from_unixtime(unix_timestamp({col}), 'yyyy-MM-01 00:00:00')", + "P0.25Y": "date_format(add_months(trunc({col}, 'MM'), -(month({col})-1)%3), 'yyyy-MM-dd 00:00:00')", + "P1Y": "from_unixtime(unix_timestamp({col}), 'yyyy-01-01 00:00:00')", + "P1W/1970-01-03T00:00:00Z": "date_format(date_add({col}, INT(6-from_unixtime(unix_timestamp({col}), 'u'))), 'yyyy-MM-dd 00:00:00')", + "1969-12-28T00:00:00Z/P1W": "date_format(date_add({col}, -INT(from_unixtime(unix_timestamp({col}), 'u'))), 'yyyy-MM-dd 00:00:00')", + } # Scoping regex at class level to avoid recompiling # 17/02/07 19:36:38 INFO ql.Driver: Total jobs = 5