octaviancorlade opened a new issue #13968:
URL: https://github.com/apache/superset/issues/13968


   #8040 restored dropping columns that are all NA, but it is problematic in 
some visualization types. 
   There is already #13612 for this issue in Bar Charts, for which I opened a 
PR, but the same applies to dual line charts if one of the lines has only null 
values. 
   The error is also not informative, since it only shows the name of the 
column.
   
   ### Expected results
   
   The null values should be shown as nulls, without data points on the charts
   
   
![image](https://user-images.githubusercontent.com/15089539/113723675-df259900-96f1-11eb-8dab-f30953fd44d1.png)
   
   
   ### Actual results
   
   The null series is dropped by `pandas.pivot_table` calls which use 
`dropna=True` as default, and the user can only see the text of a `KeyError`:
   
   
![image](https://user-images.githubusercontent.com/15089539/113723786-fa90a400-96f1-11eb-96ba-19d3f3b06586.png)
   
   The stacktrace for the dual line chart:
   ```
   ERROR:superset.views.base:'metric1'
   Traceback (most recent call last):
     File "/app/superset/views/base.py", line 181, in wraps
       return f(self, *args, **kwargs)
     File "/app/superset/utils/log.py", line 164, in wrapper
       value = f(*args, **kwargs)
     File "/app/superset/utils/cache.py", line 152, in wrapper
       return f(*args, **kwargs)
     File "/app/superset/views/utils.py", line 451, in wrapper
       return f(*args, **kwargs)
     File "/app/superset/views/core.py", line 619, in explore_json
       return self.generate_json(viz_obj, response_type)
     File "/app/superset/views/core.py", line 456, in generate_json
       payload = viz_obj.get_payload()
     File "/app/superset/viz.py", line 464, in get_payload
       payload["data"] = self.get_data(df)
     File "/app/superset/viz.py", line 1531, in get_data
       chart_data = self.to_series(df)
     File "/app/superset/viz.py", line 1500, in to_series
       ys = series[m]
   KeyError: 'metric1'
   ```
   
   #### How to reproduce the bug
   
   1. Open a bar chart, a dual line chart, or other charts that use 
`pandas.pivot_table` in `viz.py`
   2. Choose a metric that only returns null values for the selected period. 
This is true for e.g. `sum(1)+null` in most SQL dialects
   
   ### Environment
   
   I used the latest master with docker
   
   ### Checklist
   
   Make sure to follow these steps before submitting your issue - thank you!
   
   - [X] I have checked the superset logs for python stacktraces and included 
it here as text if there are any.
   - [X] I have reproduced the issue with at least the latest released version 
of superset.
   - [X] I have checked the issue tracker for the same issue and I haven't 
found one similar.
   
   


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