You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/02/17 06:04:59 UTC

[GitHub] [superset] villebro commented on a change in pull request #13086: fix: accept null groupby in form data for timeseries table viz

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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org