deephaven / deephaven-core

Deephaven Community Core
Other
254 stars 80 forks source link

Advanced filter select distinct behaves differently from table operation select distinct on object columns #5280

Open jjbrosnan opened 7 months ago

jjbrosnan commented 7 months ago

Description

If using advanced filters from the GUI to pick distinct values in a column, there are a large number of repeated identical values if doing so on an object or pyobject column.

Steps to reproduce

From the server-side Python API:

from deephaven import empty_table

def foo(idx):
    if idx % 2 == 0:
        return 3
    else:
        return None

t = empty_table(20).update("X = foo(i)")
t2 = empty_table(20).update("X = (Object)foo(i)")

Then, call select_distinct on either table. The result has 2 rows as expected. Lastly, use the advanced filters from the GUI on the X column. There are numerous repeated 3 entries, and a single null entry.

Expected results

The GUI advanced filters to look the same as the select_unique table operation.

Actual results

Numerous repeated identical values in the GUI advanced filter menu.

Additional details and attachments

Versions

hhashim1 commented 7 months ago

In addition to UI being unable to filter, the issue is also present when querying. Neither of the below lines has an outcome. The query lines are ignored. The originating column is a string datatype (see attached image) with values being -2,0, or 2.

image

f"atr_bullish_breakout_{k}_{tf} = ((atr_stop_type_diff_{k}_{tf} == 2))", f"atr_bearish_breakout_{k}_{tf} = ((atr_stop_type_diff_{k}_{tf} == (double)-2))",

nbauernfeind commented 5 months ago

Ryan Says:

selectDistinct on the underlying table, not the previewed table, then apply previews to the result, and maybe have a clear way to "reverse" previews to make sure the selection picks the right value. Disable these kinds of widgets on preview columns, since they're hard to get right.

https://github.com/deephaven/deephaven-core/pull/5281#issuecomment-2115972706

Otherwise, I've merged a band-aid that makes the widget look sane even if we probably don't want to support filtering previewed columns.