| 2182 | |
| 2183 | |
| 2184 | def 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 | |
| 2210 | def test_concat_batches_different_schema(): |