-
Notifications
You must be signed in to change notification settings - Fork 13.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bugfix] _add_filters_from_pre_query doesn't handle dim specs #3974
Conversation
Thanks @Mogball for taking a look at this. I just applied the patch and tested it out. I now get "No data was returned" instead of the exception. If I click on View Query it only shows the first phase of the query and not the second. When I run that query directly against druid, I get results for the topN. |
@ghulands Thanks for letting me know. I removed a condition thinking Druid handles single |
90661b0
to
3693e38
Compare
Still the same behavior observed with updated patch. |
Could you post logs from running these queries? (And it's still just doing 1 phase right?) |
Yes, it's still only running 1 phase. I edited the log to reduce the map size of the dimension.
|
Okay I think I figured it out. Extraction functions that change the name of dimension values (in your case, mapping from a code to a name) cause issues with the two-phase query because it builds additional filters from output values (which are different from the original values). |
Hi @Mogball, This now works! Thanks so much for the quick iterating on it. |
@fabianmenges RFC on this solution For two-phase queries, would it be better to remove extraction functions from pre-queries (and just use the dimension name) and add them back for the final query? |
2ba7180
to
09865e2
Compare
I think it makes sense to strip the pre-queries (phase 1 queries) from the extraction functions since they will only change how data is displayed and pre-queries won't be displayed. |
def pre_update(self, col): | ||
# If a dimension spec JSON is given, ensure that it is | ||
# valid JSON and that `outputName` is specified | ||
if col.dimension_spec_json: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I like the validation here in general, I feel like its a bit arbitrary that we validate that
dimension_spec_json
is valid but we don't do any validation for SQL columns or SQL/Druid metrics.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed as well. Should we starting adding validation (or 'warnings') for other things as well?
b675caa
to
cf30a20
Compare
cf30a20
to
963f895
Compare
superset/connectors/druid/models.py
Outdated
pre_qry_dims.append(dim['dimension']) | ||
else: | ||
pre_qry_dims.append(dim) | ||
pre_qry['dimensions'] = utils.unique_list(pre_qry_dims) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason your not just doing this list(set(pre_qry_dims))
superset/utils.py
Outdated
@@ -746,3 +746,9 @@ def get_filter_key(f): | |||
form_data['filters'] += [filtr] | |||
# Remove extra filters from the form data since no longer needed | |||
del form_data['extra_filters'] | |||
|
|||
def unique_list(target_list): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't think this helper is useful
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the easy way to do this is list(set(list))
though you can usually just use a set from the get go and stick to it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true didn't realise it was that simple 🥇
963f895
to
2361192
Compare
Hi, i am facing the same issue.On running single custom dimension i get the following error: Can you specify which version of druid to use? and what is the fix? @Mogball does your fix solve this? |
What version of superset are you using? I think this is in version 0.21.0 |
I am using 0.20.
Extensions are non filterable.And single extesion dimension is non
groupable.Any reason why topN query doesnt work on superset for single
extension dimension?
Same works if i hit the same query on druid.
…On Fri, 2 Feb 2018 at 11:26 PM, Jeff Niu ***@***.***> wrote:
What version of superset are you using? I think this is in version 0.21.0
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#3974 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AZHoWqVf9oZpz8uZRY9bE9R22yQEVQtZks5tQ0WhgaJpZM4QyqYb>
.
|
Does 0.21 solve both the mentioned problems? I am using 0.20. |
I'm pretty sure those issues we're ironed out by then. Give 0.21.0 a try |
Hi @Mogball that was great help.I am now able to group the custom dimensions as well as view them on charts. Do we have any update/workaround for filtering the same custom extension.I am able to only filter them through Result filters only. |
Not sure about that. Make an issue if there isn't one already. |
…#3974) * Fixed _add_filters_from_pre_query for dimension specs * add_filters_from_pre_query ignores extraction functions
…#3974) * Fixed _add_filters_from_pre_query for dimension specs * add_filters_from_pre_query ignores extraction functions
Ok this should address the underlying issue behind #3943.
_add_filter_from_pre_query_data
wasn't at all handling dimension specs. Also added some better error checking on modifying dimension specs.edit: #3889 similar issue