Skip to content

Commit

Permalink
Make meta consistent with results of cross join (#300)
Browse files Browse the repository at this point in the history
* Drop temp join column for single partition case

* Adjust cross join meta instead of partitions
  • Loading branch information
charlesbluca authored Nov 9, 2021
1 parent b5766b7 commit 2194a75
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
6 changes: 5 additions & 1 deletion dask_sql/physical/rel/logical/join.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,11 @@ def merge_single_partitions(lhs_partition, rhs_partition):
)

meta = dd.dispatch.concat(
[df_lhs_renamed._meta_nonempty, df_rhs_renamed._meta_nonempty], axis=1
[
df_lhs_renamed._meta_nonempty.assign(common=1),
df_rhs_renamed._meta_nonempty,
],
axis=1,
)
# TODO: Do we know the divisions in any way here?
divisions = [None] * (len(dsk) + 1)
Expand Down
10 changes: 9 additions & 1 deletion tests/integration/test_compatibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,15 @@ def test_join_left():
def test_join_cross():
a = make_rand_df(10, a=(int, 4), b=(str, 4), c=(float, 4))
b = make_rand_df(20, dd=(float, 1), aa=(int, 1), bb=(str, 1))
eq_sqlite("SELECT * FROM a CROSS JOIN b", a=a, b=b)
eq_sqlite(
"""
SELECT * FROM a
CROSS JOIN b
ORDER BY a.a NULLS FIRST, a.b NULLS FIRST, a.c NULLS FIRST, dd NULLS FIRST
""",
a=a,
b=b,
)


def test_join_multi():
Expand Down

0 comments on commit 2194a75

Please sign in to comment.