superset icon indicating copy to clipboard operation
superset copied to clipboard

[SIP-124] Add a text filter working as "like" to allow user to filter as dashboard_filter (generic solution) or as table_filter (specific solution)

Open nigzak opened this issue 1 year ago • 9 comments

[SIP-124] Proposal for add a text filter working as "like" to allow user to filter as dashboard_filter (generic solution) or as table_filter (specific solution)

Motivation

If you have a bigger raw table in superset including a text value there is no good option available to search for a dedicated value in this table.

Constructed example (maybe bad as example, only for demonstrate the motivation): There are values in the text value in table in column MY_COL:

<NUMBER><TEXT><NUMBER> ex:

1_SOMETEXT_2
4_SOMETEXT_5
9BLA2
BLA   (no number)

and you want to filter in the table as example to (* as placeholder for "any" value)

*9_SOMETEXT_4*
*TEXT*
*9*
*A*

There is no good way to filter in this way in the table.

Other example:

lets say you have a list of trackingids which are TEXT some persons enter there userid as prefix (ex: USER1<TEXT>, concreate example USER1XYZTESTWHATEVER) USER1 wants to filter in the table to his values so he wants a filter for %USER1% (also possible USER1%)

Proposed Change

a) add a filter for dashboard let the user add a textfield which works like he can enter a "value" the table can filter in the way for

*{{value}}*

in the table to reduce the table rows

b) add a "table only" filter possibility to let the user enter some values in the table headers to filter (=no dashboard filter, more a chart filter) like he can click on a column (to be defined: how to separate between "order" and "enter value, might be "on text = order", "right_to_text=box appears") to enter a "value" a small textbox would appear where he can "click" to enter a text which filters the dedicated column like

 *{{value}}*

// hint to the value

*{{value}}*

in SQL syntax would mean to work in a way as "like %value%" (search for ANY match in the string) If we allow the "%" and the "_" also (or * as replacement) as a search keyword it might be also possible to search for all combinations like

exact (value) or non-exact (%value, value%, %value%, _value, ... and so on)

New or Changed Public Interfaces

VAR a) new "text filter" on dashboard level VAR b) change to table to add a text filter only there

Hint: in principle there might be also reasons to have also a global filter for other reasons than only a raw table, similar to a KIBANA to search for a dedicated value to reduce multiple dashboards

ex:

data
<n:m>
dependencies

(1 data can have multiple (m) dependencies, 1 dependency can have multiple data (n) => n:m )

dashboards with charts depending rows to dependencies
there are valid reasons that a user wants to fitler ALL charts to dedicated data(s) 
to see only dependencies for one specific data (or a filtered subset) based on a text value

an example could bededicated trackingid(s)  
(refer up motivation => user trackingid example)

New dependencies

unknown

Migration Plan and Compatibility

unknown

Rejected Alternatives

no support to explicit search for some values

nigzak avatar Mar 26 '24 17:03 nigzak

could be a great plus also support wildcards for example (abc, abc, abc) and (-abc -def) for exclude words

dacopan avatar Apr 04 '24 03:04 dacopan

same functionality could be usefull in filterbox in dashboard filters

dacopan avatar Apr 04 '24 03:04 dacopan

There's a much older and discarded SIP that relates to this here: https://github.com/apache/superset/issues/8452

Historically, when a "LIKE" filter idea comes up, the subject of performance (particularly with large tables) usually ensues.

That older SIP had an interesting idea of adding a few options (perhaps a select dropdown) which could let you pick the matching criteria, e.g.:

contains => column LIKE '%value%'
does not contain => column NOT LIKE '%value%'
starts with => column LIKE '%value'
ends with => column LIKE 'value%'
is empty => column IS NULL
is not empty => column IS NOT NULL

rusackas avatar Apr 04 '24 22:04 rusackas

I think that could be a two separated functionality, one as native filter as mention @rusackas and another inside tables in dashboard (related with https://github.com/apache/superset/issues/27645)

dacopan avatar Apr 05 '24 03:04 dacopan

This sip needs to be moved forward to a DISCUSSION thread on the mailing list if it is to be considered.

rusackas avatar Apr 23 '24 15:04 rusackas

Hi @rusackas

can you let me know how to do this? Make a "copy" of it in discussion thread? I sadly did not find a button to move it to a discussion thread

nigzak avatar Apr 28 '24 09:04 nigzak

First step is to subscribe to the Superset Dev mailing list, by sending an email to [email protected]. Once you're verified/subscribed, you can send an email to [email protected] with the [DISCUSS] subject and a link to this thread here.

Here's a recent example, available on the web-hosted mirror of the mailing list:https://lists.apache.org/thread/6o0zkggo6b68nr362mgrrdzt9k6odb9j

rusackas avatar Apr 29 '24 15:04 rusackas

Oh, and once that's done and the discussion settles out, we can bring it up for a VOTE thread to make it official.

rusackas avatar Apr 29 '24 15:04 rusackas