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 2019/11/27 14:44:15 UTC

[GitHub] [incubator-superset] elukey opened a new issue #8676: Sunburst Chart failure when using IS NOT NULL filter (regression from 0.34 to 0.35)

elukey opened a new issue #8676: Sunburst Chart failure when using IS NOT NULL filter (regression from 0.34 to 0.35)
URL: https://github.com/apache/incubator-superset/issues/8676
 
 
   I just updated to 0.35 via pypi, and I noticed that one Sunburst Chart in a dashboard was broken, reporting this failure:
   
   ```
   Traceback (most recent call last):
     File "/srv/deployment/analytics/superset/venv/lib/python3.7/site-packages/superset/viz.py", line 418, in get_df_payload
       df = self.get_df(query_obj)
     File "/srv/deployment/analytics/superset/venv/lib/python3.7/site-packages/superset/viz.py", line 203, in get_df
       self.results = self.datasource.query(query_obj)
     File "/srv/deployment/analytics/superset/venv/lib/python3.7/site-packages/superset/connectors/druid/models.py", line 1377, in query
       query_str = self.get_query_str(client=client, query_obj=query_obj, phase=2)
     File "/srv/deployment/analytics/superset/venv/lib/python3.7/site-packages/superset/connectors/druid/models.py", line 984, in get_query_str
       return self.run_query(client=client, phase=phase, **query_obj)
     File "/srv/deployment/analytics/superset/venv/lib/python3.7/site-packages/superset/connectors/druid/models.py", line 1355, in run_query
       client.groupby(**qry)
     File "/srv/deployment/analytics/superset/venv/lib/python3.7/site-packages/pydruid/client.py", line 307, in groupby
       query = self.query_builder.groupby(kwargs)
     File "/srv/deployment/analytics/superset/venv/lib/python3.7/site-packages/pydruid/query.py", line 367, in groupby
       return self.build_query(query_type, args)
     File "/srv/deployment/analytics/superset/venv/lib/python3.7/site-packages/pydruid/query.py", line 295, in build_query
       query_dict[key] = Filter.build_filter(val)
     File "/srv/deployment/analytics/superset/venv/lib/python3.7/site-packages/pydruid/utils/filters.py", line 119, in build_filter
       filter = filter_obj.filter['filter']
   AttributeError: 'bool' object has no attribute 'filter'
   ```
   
   ### Expected results
   
   The chart correctly visualized as in 0.34.
   
   ### Actual results
   
   See stacktrace above.
   
   #### Screenshots
   
   If applicable, add screenshots to help explain your problem.
   
   #### How to reproduce the bug
   
   1. Go to '...'
   2. Click on '....'
   3. Scroll down to '....'
   4. See error
   
   ### Environment
   
   (please complete the following information):
   
   - superset version: `0.35
   - python version: `python 3.7.3`
   - node.js version: `v10.17.0`
   - npm version: `6.11.3`
   
   ### Checklist
   
   Make sure these boxes are checked 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.
   
   ### Additional context
   
   I tried to debug it a little bit and tracked down the code responsible for this. In `superset/connectors/druid/models.py`, before `client.groupby(**qry)` I logged `qry`:
   
   ```
   Nov 27 14:30:08 an-tool1005 superset[3824]: 2019-11-27 14:30:08,350:INFO:root:Query: {'datasource': 'edits_hourly', 'dimensions': ['user_is_anonymous', 'project', 'is_reverted', 'user_groups'], 'aggre
   gations': OrderedDict([('SUM(edit_count)', {'fieldName': 'edit_count', 'fieldNames': ['edit_count'], 'type': 'longSum', 'name': 'SUM(edit_count)'})]), 'granularity': 'all', 'post_aggregations': Ordere
   dDict(), 'intervals': '2018-07-01T00:00:00+00:00/2019-07-01T00:00:00+00:00', 'filter': True, 'limit_spec': {'type': 'default', 'limit': 50000, 'columns': [{'dimension': 'SUM(edit_count)', 'direction':
    'descending'}]}}
   ```
   Focus is on `'filter': True`, that later on in pydruid's `build_query` is not accepted. Backtracking a little bit to the following line, and then logging `filter` and `filters`:
   
   ```
   filters = DruidDatasource.get_filters(filter, self.num_cols, columns_dict)
   
   filters -> [{'col': 'user_is_anonymous', 'op': 'IS NOT NULL', 'val': ''}]
   filter -> True
   ```
   Eventually ending up in this bit of the `get_filters` function:
   
   ```
               elif op == "IS NOT NULL":
                   cond = Dimension(col) is not None
   
               if filters:
                   filters = Filter(type="and", fields=[cond, filters])
               else:
                   filters = cond
   ```
   
   It seems that `cond` is returned as simple bool:True in the last else. I didn't see any recent commit so I am not sure what changed, but with 0.34 I didn't see any issue.
   
   

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


With regards,
Apache Git Services

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