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

Function test_concat_batches

python/pyarrow/tests/test_table.py:2184–2207  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2182
2183
2184def test_concat_batches():
2185 data = [
2186 list(range(5)),
2187 [-10., -5., 0., 5., 10.]
2188 ]
2189 data2 = [
2190 list(range(5, 10)),
2191 [1., 2., 3., 4., 5.]
2192 ]
2193
2194 t1 = pa.RecordBatch.from_arrays([pa.array(x) for x in data],
2195 names=('a', 'b'))
2196 t2 = pa.RecordBatch.from_arrays([pa.array(x) for x in data2],
2197 names=('a', 'b'))
2198
2199 result = pa.concat_batches([t1, t2])
2200 result.validate()
2201 assert len(result) == 10
2202
2203 expected = pa.RecordBatch.from_arrays([pa.array(x + y)
2204 for x, y in zip(data, data2)],
2205 names=('a', 'b'))
2206
2207 assert result.equals(expected)
2208
2209
2210def test_concat_batches_different_schema():

Callers

nothing calls this directly

Calls 5

listFunction · 0.85
lenFunction · 0.85
equalsMethod · 0.80
arrayMethod · 0.45
validateMethod · 0.45

Tested by

no test coverage detected