Skip to content

Commit 3d83c1f

Browse files
committed
Add test for ordering of record batches in arrow C stream
1 parent bb886c9 commit 3d83c1f

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

python/tests/test_dataframe.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1610,6 +1610,23 @@ def test_arrow_c_stream_to_table(fail_collect):
16101610
assert table.column("a").num_chunks == 2
16111611

16121612

1613+
def test_arrow_c_stream_order():
1614+
ctx = SessionContext()
1615+
1616+
batch1 = pa.record_batch([pa.array([1])], names=["a"])
1617+
batch2 = pa.record_batch([pa.array([2])], names=["a"])
1618+
1619+
df = ctx.create_dataframe([[batch1, batch2]])
1620+
1621+
table = pa.Table.from_batches(df)
1622+
expected = pa.Table.from_batches([batch1, batch2])
1623+
1624+
assert table.equals(expected)
1625+
col = table.column("a")
1626+
assert col.chunk(0)[0].as_py() == 1
1627+
assert col.chunk(1)[0].as_py() == 2
1628+
1629+
16131630
def test_arrow_c_stream_reader(df):
16141631
reader = pa.RecordBatchReader._import_from_c_capsule(df.__arrow_c_stream__())
16151632
assert isinstance(reader, pa.RecordBatchReader)

0 commit comments

Comments
 (0)