Skip to content

Commit 2194a75

Browse files
authored
Make meta consistent with results of cross join (#300)
* Drop temp join column for single partition case * Adjust cross join meta instead of partitions
1 parent b5766b7 commit 2194a75

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

dask_sql/physical/rel/logical/join.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,11 @@ def merge_single_partitions(lhs_partition, rhs_partition):
140140
)
141141

142142
meta = dd.dispatch.concat(
143-
[df_lhs_renamed._meta_nonempty, df_rhs_renamed._meta_nonempty], axis=1
143+
[
144+
df_lhs_renamed._meta_nonempty.assign(common=1),
145+
df_rhs_renamed._meta_nonempty,
146+
],
147+
axis=1,
144148
)
145149
# TODO: Do we know the divisions in any way here?
146150
divisions = [None] * (len(dsk) + 1)

tests/integration/test_compatibility.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,15 @@ def test_join_left():
239239
def test_join_cross():
240240
a = make_rand_df(10, a=(int, 4), b=(str, 4), c=(float, 4))
241241
b = make_rand_df(20, dd=(float, 1), aa=(int, 1), bb=(str, 1))
242-
eq_sqlite("SELECT * FROM a CROSS JOIN b", a=a, b=b)
242+
eq_sqlite(
243+
"""
244+
SELECT * FROM a
245+
CROSS JOIN b
246+
ORDER BY a.a NULLS FIRST, a.b NULLS FIRST, a.c NULLS FIRST, dd NULLS FIRST
247+
""",
248+
a=a,
249+
b=b,
250+
)
243251

244252

245253
def test_join_multi():

0 commit comments

Comments
 (0)