deephaven-core icon indicating copy to clipboard operation
deephaven-core copied to clipboard

`merge` should produce an index if all inputs have an index

Open chipkent opened this issue 4 months ago • 0 comments

The table resulting from a merge should contain an index when constituent tables have an index.

For example, below t1 and t2 have an index with the same key, but t4 does not. This request is for t4 to also have the index.

from deephaven import empty_table, merge
from deephaven.experimental.data_index import data_index, has_data_index

t1 = empty_table(100).update(["I=ii%5", "X=random()"])
t2 = empty_table(100).update(["I=ii%5", "X=random()"])

t3 = merge([t1, t2])

print(has_data_index(t1, ["I"]), has_data_index(t2, ["I"]), has_data_index(t3, ["I"]))

data_index(t1, ["I"])
data_index(t2, ["I"])

t4 = merge([t1, t2])
print(has_data_index(t1, ["I"]), has_data_index(t2, ["I"]), has_data_index(t4, ["I"]))

Returns:

False False False
True True False

chipkent avatar Oct 01 '24 19:10 chipkent