superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maximebeauche...@apache.org
Subject [incubator-superset] branch master updated: [druid] fix 2 phases queries that specify 'Sort By' on 'Series limit' (#4203)
Date Fri, 12 Jan 2018 19:29:27 GMT
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 8069d62  [druid] fix 2 phases queries that specify 'Sort By' on 'Series limit' (#4203)
8069d62 is described below

commit 8069d6221d943694f544a2977deac1089176189a
Author: Maxime Beauchemin <maximebeauchemin@gmail.com>
AuthorDate: Fri Jan 12 11:29:24 2018 -0800

    [druid] fix 2 phases queries that specify 'Sort By' on 'Series limit' (#4203)
---
 superset/connectors/druid/models.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/superset/connectors/druid/models.py b/superset/connectors/druid/models.py
index ff3251a..5703809 100644
--- a/superset/connectors/druid/models.py
+++ b/superset/connectors/druid/models.py
@@ -1117,12 +1117,13 @@ class DruidDatasource(Model, BaseDatasource):
         ):
             dim = list(qry.get('dimensions'))[0]
             logging.info('Running two-phase topn query for dimension [{}]'.format(dim))
+            pre_qry = deepcopy(qry)
             if timeseries_limit_metric:
                 order_by = timeseries_limit_metric
+                pre_qry['aggregations'] = self.get_aggregations([timeseries_limit_metric])
             else:
                 order_by = list(qry['aggregations'].keys())[0]
             # Limit on the number of timeseries, doing a two-phases query
-            pre_qry = deepcopy(qry)
             pre_qry['granularity'] = 'all'
             pre_qry['threshold'] = min(row_limit,
                                        timeseries_limit or row_limit)

-- 
To stop receiving notification emails like this one, please contact
['"commits@superset.apache.org" <commits@superset.apache.org>'].

Mime
View raw message