rpbouman / huey

A UI for DuckDB
MIT License
234 stars 16 forks source link

Filter on aggregated values #162

Open IvoMoor opened 3 weeks ago

IvoMoor commented 3 weeks ago

Would be nice to be able to filter on an aggregated value (like != 0)

rpbouman commented 1 week ago

There are multiple challenges to consider:

rpbouman commented 4 days ago

After some thought I think this should initially be implemented as a feature for a subclass of queries/reports:

If there is only one tuples axis (rows or columns) and the other axis is empty, then we can fold the cells and tuples query into one SQL query and use HAVING to actually restrict the resultset. (Also, see: https://github.com/rpbouman/huey/issues/21)

The trouble starts when we have 2 axes - in that case, it is impossible to know whether a particular row or column tuple should be hidden because all its cells don't satisfy the condition without executing the query for all possible tuples (along both axes). In other words, that requires execution of the entire crosstab dataset. (we're not going to support that any time soon)

rpbouman commented 4 days ago

If we accept the limitation of having only one tuples axis, then we need only worry about how this would work in the UI. There are two states where we need to take care:

We can think of two different UI styles: