Skip to content

Commit

Permalink
Fixed single extraction dimension error (apache#3796)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mogball authored and mistercrunch committed Nov 8, 2017
1 parent c1a4db8 commit 3dc0fa4
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions superset/connectors/druid/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,13 @@ def run_query( # noqa / druid
if len(groupby) == 0 and not having_filters:
del qry['dimensions']
client.timeseries(**qry)
if not having_filters and len(groupby) == 1 and order_desc:

if (
not having_filters and
len(groupby) == 1 and
order_desc and
not isinstance(list(qry.get('dimensions'))[0], dict)
):
dim = list(qry.get('dimensions'))[0]
if timeseries_limit_metric:
order_by = timeseries_limit_metric
Expand All @@ -995,7 +1001,7 @@ def run_query( # noqa / druid
if phase == 1:
return query_str
query_str += (
"//\nPhase 2 (built based on phase one's results)\n")
"// Phase 2 (built based on phase one's results)\n")
df = client.export_pandas()
qry['filter'] = self._add_filter_from_pre_query_data(
df,
Expand Down Expand Up @@ -1037,7 +1043,7 @@ def run_query( # noqa / druid
if phase == 1:
return query_str
query_str += (
"//\nPhase 2 (built based on phase one's results)\n")
"// Phase 2 (built based on phase one's results)\n")
df = client.export_pandas()
qry['filter'] = self._add_filter_from_pre_query_data(
df,
Expand Down

0 comments on commit 3dc0fa4

Please sign in to comment.