Skip to content

Commit 57421d1

Browse files
authored
[bugfix] preserve order in groupby (#3268)
Recently in 4c3313b I introduced an issue where the order of groupby fields might change. This addresses this issue and will preserve ordering.
1 parent 0cf0860 commit 57421d1

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

superset/viz.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,13 @@ def get_extra_filters(self):
112112
def query_obj(self):
113113
"""Building a query object"""
114114
form_data = self.form_data
115-
groupby = form_data.get("groupby") or []
115+
gb = form_data.get("groupby") or []
116116
metrics = form_data.get("metrics") or []
117117
columns = form_data.get("columns") or []
118-
groupby = list(set(groupby + columns))
118+
groupby = []
119+
for o in gb + columns:
120+
if o not in groupby:
121+
groupby.append(o)
119122

120123
is_timeseries = self.is_timeseries
121124
if DTTM_ALIAS in groupby:

0 commit comments

Comments
 (0)