Incubator-superset: Filter box triggers multiple queries for each filter control

Created on 4 Jul 2017  路  6Comments  路  Source: apache/incubator-superset

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

Expected results

Filter box on multiple filter controls should run a single query and generate filter options

Actual results

Current filter box generates multiple queries which is inefficient. For eg:
I add options A, B, C in Filter control and sum of some column as metric (Though it doesnt make sense to have a metric for filter box). It generates below 4 queries

Select A, B, C, sum() from {subquery} group by A,B,C
Select A, sum() from {subquery} group by A
Select B, sum() from {subquery} group by B
Select C, sum() from {subquery} group by C

It would be great if we can simplify this and remove the option for metric in filter box.

Most helpful comment

Actually it has to run multiple queries as the metric may not be additive (count distinct for instance). Also there could be cardinality issues as the cartesian product may be very large.

We could parallelize them though to save some time.

I'm thinking we need to re-write the whole Filter box component to offer much more functionality, where each filter needs to have its own configuration elements (allow picking a metric or not, sort order, allow-multi-choices, ...)

All 6 comments

Anyone has any pointers on how the code can be modified to improve the efficiency of filters will be helpful.

Actually it has to run multiple queries as the metric may not be additive (count distinct for instance). Also there could be cardinality issues as the cartesian product may be very large.

We could parallelize them though to save some time.

I'm thinking we need to re-write the whole Filter box component to offer much more functionality, where each filter needs to have its own configuration elements (allow picking a metric or not, sort order, allow-multi-choices, ...)

Thanks for the response. However, I did not understand the need for a metric in Filter box. Cant we do a simple distinct for each filter option? Also I agree with additional config elements for each filter. Such as allow single choice vs multi choice. Radio box, Check box, etc.

Thanks

The metric can be nice as it sorts the values based on the metric. Say if we have a filter on the "Market" dimension at Airbnb it would show the biggest markets on top.

Ok. That makes sense to me now.
Probably then having defined number of queries trigger in parallel might help speed up.

Notice: this issue has been closed because it has been inactive for 257 days. Feel free to comment and request for this issue to be reopened.

Was this page helpful?
0 / 5 - 0 ratings