villebro commented on a change in pull request #10633:
URL: 
https://github.com/apache/incubator-superset/pull/10633#discussion_r472762085



##########
File path: superset/viz.py
##########
@@ -322,7 +322,8 @@ def query_obj(self) -> QueryObjectDict:
         gb = self.groupby
         metrics = self.all_metrics or []
         columns = form_data.get("columns") or []
-        groupby = list(set(gb + columns))
+        # merge list and dedup while preserving order
+        groupby = list(OrderedDict.fromkeys(gb + columns))

Review comment:
       Nit, as of 3.7 key order is now officially guaranteed (already 
implicitly so in 3.6), so no need to use `OrderedDict` any more: 
   ```suggestion
           groupby = list(dict.fromkeys(gb + columns))
   ```
   Reference: 
https://docs.python.org/3.7/tutorial/datastructures.html#dictionaries
   > Performing `list(d)` on a dictionary returns a list of all the keys used 
in the dictionary, in insertion order
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to