Filter by lookup
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 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
Superset version
0.22.1
Expected results
When using a registered lookup as a dimension (using the dimensionSpec) we should be able to filter by it.
Actual results
When applying the filter we got no data as a result.
I am getting similar results for Druid data sources only I didn't realize it until I tried to look at the == results instead on !=. I'm on version v0.24.0. For some reason, the filter is not being applied correctly. I looked at the query that is generated and the lookup is passed and the filter is also applied in the query. This makes me think it is something on the druid end or how exactly the query is formed.
Possible solutions in fixing the query building piece:
-
Add an extractionFn to the selector filter which repeats the map from the list of dimensions. http://druid.io/docs/latest/querying/filters.html#filtering-with-extraction-functions
-
Use a having filter instead which will apply the filter after the grouping.
The former is slightly more performant.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue .pinned to prevent stale bot from closing the issue.
Dealing with the same issue when trying to filter with lookup, however the error i am getting is relevant to pydruid|:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/superset/viz.py", line 417, in get_df_payload
df = self.get_df(query_obj)
File "/usr/local/lib/python3.6/site-packages/superset/viz.py", line 202, in get_df
self.results = self.datasource.query(query_obj)
File "/usr/local/lib/python3.6/site-packages/superset/connectors/druid/models.py", line 1372, in query
query_str = self.get_query_str(client=client, query_obj=query_obj, phase=2)
File "/usr/local/lib/python3.6/site-packages/superset/connectors/druid/models.py", line 984, in get_query_str
return self.run_query(client=client, phase=phase, **query_obj)
File "/usr/local/lib/python3.6/site-packages/superset/connectors/druid/models.py", line 1200, in run_query
filters = DruidDatasource.get_filters(filter, self.num_cols, columns_dict)
File "/usr/local/lib/python3.6/site-packages/superset/connectors/druid/models.py", line 1548, in get_filters
alphaNumeric=is_numeric_col,
File "/usr/local/lib/python3.6/site-packages/pydruid/utils/filters.py", line 87, in __init__
"ordering": args["ordering"],
KeyError: 'ordering'