Skip to content

Commit 03d83c2

Browse files
committed
There was no guarantee that the record batches would be returned in a single partition, so update the unit test to check all partitions.
1 parent f0cb5e1 commit 03d83c2

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

python/tests/test_dataframe.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -755,13 +755,20 @@ def test_execution_plan(aggregate_df):
755755
assert "CsvExec:" in indent
756756

757757
ctx = SessionContext()
758-
stream = ctx.execute(plan, 0)
759-
# get the one and only batch
760-
batch = stream.next()
761-
assert batch is not None
762-
# there should be no more batches
763-
with pytest.raises(StopIteration):
764-
stream.next()
758+
rows_returned = 0
759+
for idx in range(0, plan.partition_count):
760+
stream = ctx.execute(plan, idx)
761+
try:
762+
batch = stream.next()
763+
assert batch is not None
764+
rows_returned += len(batch.to_pyarrow()[0])
765+
except StopIteration:
766+
# This is one of the partitions with no values
767+
pass
768+
with pytest.raises(StopIteration):
769+
stream.next()
770+
771+
assert rows_returned == 5
765772

766773

767774
def test_repartition(df):

0 commit comments

Comments
 (0)