fix: handle duplicate groupby keys (#8658)

* fix: handle duplicate groupby keys

* Also de-duping upfront
This commit is contained in:
Maxime Beauchemin
2020-02-14 13:40:26 -08:00
committed by GitHub
parent f4ad15e644
commit 35c697560e
2 changed files with 7 additions and 0 deletions

View File

@@ -721,6 +721,9 @@ class SqlaTable(Model, BaseDatasource):
groupby_exprs_sans_timestamp: OrderedDict = OrderedDict()
if groupby:
# dedup columns while preserving order
groupby = list(dict.fromkeys(groupby))
select_exprs = []
for s in groupby:
if s in cols:

View File

@@ -970,6 +970,10 @@ class BubbleViz(NVD3Viz):
d["groupby"] = [form_data.get("entity")]
if form_data.get("series"):
d["groupby"].append(form_data.get("series"))
# dedup groupby if it happens to be the same
d["groupby"] = list(dict.fromkeys(d["groupby"]))
self.x_metric = form_data.get("x")
self.y_metric = form_data.get("y")
self.z_metric = form_data.get("size")