(compression)
| 1808 | ["bz2", "brotli", "gzip", "lz4", "zstd"] |
| 1809 | ) |
| 1810 | def test_compressed_recordbatch_stream(compression): |
| 1811 | if not Codec.is_available(compression): |
| 1812 | pytest.skip(f"{compression} support is not built") |
| 1813 | |
| 1814 | # ARROW-4836: roundtrip a RecordBatch through a compressed stream |
| 1815 | table = pa.Table.from_arrays([pa.array([1, 2, 3, 4, 5])], ['a']) |
| 1816 | raw = pa.BufferOutputStream() |
| 1817 | stream = pa.CompressedOutputStream(raw, compression) |
| 1818 | writer = pa.RecordBatchStreamWriter(stream, table.schema) |
| 1819 | writer.write_table(table, max_chunksize=3) |
| 1820 | writer.close() |
| 1821 | stream.close() # Flush data |
| 1822 | buf = raw.getvalue() |
| 1823 | stream = pa.CompressedInputStream(pa.BufferReader(buf), compression) |
| 1824 | got_table = pa.RecordBatchStreamReader(stream).read_all() |
| 1825 | assert got_table == table |
| 1826 | |
| 1827 | |
| 1828 | # ---------------------------------------------------------------------- |
nothing calls this directly
no test coverage detected