villebro commented on a change in pull request #13086:
URL: https://github.com/apache/superset/pull/13086#discussion_r577344279



##########
File path: superset/viz.py
##########
@@ -824,7 +824,8 @@ def get_data(self, df: pd.DataFrame) -> VizData:
         return dict(
             records=pt.to_dict(orient="index"),
             columns=list(pt.columns),
-            is_group_by=len(fd.get("groupby", [])) > 0,
+            # "groupby" may not exist in fd or it may exist and be None
+            is_group_by=len(fd.get("groupby") or []) > 0,

Review comment:
       I agree that this is better. However, while we're at it, I think it's 
more typical to check truthiness of the key in instances like this rather than 
`len`. Something like this should do the same thing if `fd.get("groupby")` is 
expected to return `Optional[List[Any]]`: `is_group_by=True if 
fg.get("groupby") else False`




----------------------------------------------------------------
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