MCPcopy Create free account
hub / github.com/apache/arrow / test_record_batch_reader_source

Function test_record_batch_reader_source

python/pyarrow/tests/test_acero.py:103–125  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

101
102
103def test_record_batch_reader_source():
104 table = pa.table({'a': [1, 2, 3], 'b': [4, 5, 6]})
105 reader = pa.RecordBatchReader.from_batches(
106 table.schema, table.to_batches(max_chunksize=2)
107 )
108 decl = Declaration(
109 "record_batch_reader_source", RecordBatchReaderSourceNodeOptions(reader)
110 )
111 result = decl.to_table()
112 assert result.equals(table)
113
114 # a reader can only be consumed once
115 decl = Declaration(
116 "record_batch_reader_source", RecordBatchReaderSourceNodeOptions(reader)
117 )
118 result = decl.to_table()
119 assert result.num_rows == 0
120
121 with pytest.raises(TypeError):
122 RecordBatchReaderSourceNodeOptions(table)
123
124 with pytest.raises(TypeError):
125 RecordBatchReaderSourceNodeOptions(None)
126
127
128def test_record_batch_reader_source_lazy_generator():

Callers

nothing calls this directly

Calls 4

DeclarationClass · 0.90
to_batchesMethod · 0.80
equalsMethod · 0.80
to_tableMethod · 0.45

Tested by

no test coverage detected