john-bodley commented on code in PR #20629:
URL: https://github.com/apache/superset/pull/20629#discussion_r915159759


##########
superset/charts/post_processing.py:
##########
@@ -325,9 +325,16 @@ def apply_post_process(
 
     for query in result["queries"]:
         if query["result_format"] == ChartDataResultFormat.JSON:
-            df = pd.DataFrame.from_dict(query["data"])
+            try:
+                df = pd.DataFrame.from_dict(query["data"])
+            except ValueError:  # no data error
+                return result

Review Comment:
   What is `query["data"]` in this case? Would it be preferable to first check 
whether `query["data"]` is valid? Per your unit tests it seems like this might 
be an empty string—the worst of the worst—and maybe we could/should fix this 
upstream and have it be `None`, i.e., the following works:
   
   ```python
   >>> import pandas as pd
   >>> pd.DataFrame.from_dict(None)
   Empty DataFrame
   Columns: []
   Index: []
   ```
   



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

To unsubscribe, e-mail: [email protected]

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