Histograms broken with 0.32 due to new version of pydruid
See original GitHub issueAfter upgrading to 0.32 a histogram chart that worked on 0.31 doesn’t render anymore due to a pydruid exception.
Expected results
The histogram chart correctly visualized.
Actual results
The following exception is thrown:
Traceback (most recent call last):
File "/srv/deployment/analytics/superset/venv/lib/python3.7/site-packages/superset/viz.py", line 410, 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 213, 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 1287, in query
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 884, 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 1123, in run_query
client.scan(**qry)
File "/srv/deployment/analytics/superset/venv/lib/python3.7/site-packages/pydruid/client.py", line 559, in scan
query = self.query_builder.scan(kwargs)
File "/srv/deployment/analytics/superset/venv/lib/python3.7/site-packages/pydruid/query.py", line 445, in scan
self.validate_query(query_type, valid_parts, args)
File "/srv/deployment/analytics/superset/venv/lib/python3.7/site-packages/pydruid/query.py", line 265, in validate_query
.format(valid_parts))
ValueError: Query component: dimensions is not valid for query type: scan.The list of valid components is:
['datasource', 'granularity', 'filter', 'columns', 'metrics', 'intervals', 'limit', 'context']
This is due to the following change in pydruid:
https://github.com/druid-io/pydruid/commit/0a59a70829bafc85951d05c49efb571f9f51e557
That got released in 0.5.2 (the version stated in 0.32’s requirement.txt).
I have fixed it with the following code:
--- a/superset/connectors/druid/models.py
+++ b/superset/connectors/druid/models.py
@@ -1119,7 +1119,8 @@ class DruidDatasource(Model, BaseDatasource):
columns.append('__time')
del qry['post_aggregations']
del qry['aggregations']
- qry['dimensions'] = columns
+ del qry['dimensions']
+ qry['columns'] = columns
qry['metrics'] = []
qry['granularity'] = 'all'
qry['limit'] = row_limit
Environment
(please complete the following information):
- superset version: 0.32rc2
- python version: 3.7
Checklist
Make sure these boxes are checked before submitting your issue - thank you!
- I have checked the superset logs for python stacktraces and included it here as text if there are any.
- I have reproduced the issue with at least the latest released version of superset.
- I have checked the issue tracker for the same issue and I haven’t found one similar.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Histograms broken with 0.32 due to new version of pydruid
After upgrading to 0.32 a histogram chart that worked on 0.31 doesn't render anymore due to a pydruid exception.
Read more >[GitHub] [incubator-superset] elukey opened a new issue #7368 ...
elukey opened a new issue #7368: Histograms broken with 0.32 due to new version ... that worked on 0.31 doesn't render anymore due...
Read more >pydruid - PyPI
pydruid exposes a simple API to create, execute, and analyze Druid queries. pydruid can parse query results into Pandas DataFrame objects for subsequent ......
Read more >CHANGELOG.md · update-gitignore · qq_22812535 / incubator ...
getScale() for histogram (#5878) (@kristw); #5709 fix: Pivot table not sorting formatted numeric column properly (#5709) (@arpit-agarwal) ...
Read more >main - Anaconda repo
Package Latest Version Doc Dev License linux‑64 osx‑64 win‑64
7za 920 doc LGPL X
7zip 19.00 dev LGPL‑2.1‑or‑later X
_anaconda_depends 2022.05 doc dev BSD X X...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Issue-Label Bot is automatically applying the label
#bug
to this issue, with a confidence of 0.99. Please mark this comment with 👍 or 👎 to give our bot feedback!Links: app homepage, dashboard and code for this bot.
PR merged, thanks!