deephaven / deephaven-core

Deephaven Community Core
Other
255 stars 81 forks source link

Full Outer Join Does not Properly Display Right-Values on Joined Column Without Match #5184

Open nbauernfeind opened 7 months ago

nbauernfeind commented 7 months ago

Right values are not being provided in a full outer join when there is no matching left group.

from deephaven.experimental.outer_joins import full_outer_join, left_outer_join
from deephaven import empty_table

left = empty_table(5).update(["X1 = ii", "Y = Math.sin(X1)"])
right = empty_table(5).update(["X2 = ii * 2", "Y = Math.cos(X2)"])

result = full_outer_join(l_table=left, r_table=right, on=["X1 = X2"], joins=["Z = Y"])
Screenshot 2024-02-22 at 8 37 47 AM

It does work, however, if you first rename the right column:

from deephaven.experimental.outer_joins import full_outer_join, left_outer_join
from deephaven import empty_table

left = empty_table(5).update(["X1 = ii", "Y = Math.sin(X1)"])
right = empty_table(5).update(["X2 = ii * 2", "Y = Math.cos(X2)"])

result = full_outer_join(l_table=left, r_table=right.rename_columns(["X1 = X2"]), on=["X1"], joins=["Z = Y"])
Screenshot 2024-02-22 at 8 38 01 AM

Thanks to @robbcamera for reporting.

nbauernfeind commented 4 months ago

Initial approach in #5190 wasn't quite good enough. This is the approach we've agreed on now: