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

Function test_buffer_contents

python/pyarrow/tests/parquet/test_basic.py:827–844  ·  view source on GitHub ↗
(
        array_factory, read_dictionary
)

Source from the content-addressed store, hash-verified

825])
826@pytest.mark.parametrize('read_dictionary', [False, True])
827def test_buffer_contents(
828 array_factory, read_dictionary
829):
830 # Test that null values are deterministically initialized to zero
831 # after a roundtrip through Parquet.
832 # See ARROW-8006 and ARROW-8011.
833 orig_table = pa.Table.from_pydict({"col": array_factory()})
834 bio = io.BytesIO()
835 pq.write_table(orig_table, bio, use_dictionary=True)
836 bio.seek(0)
837 read_dictionary = ['col'] if read_dictionary else None
838 table = pq.read_table(bio, use_threads=False,
839 read_dictionary=read_dictionary)
840
841 for col in table.columns:
842 [chunk] = col.chunks
843 buf = chunk.buffers()[1]
844 assert buf.to_pybytes() == buf.size * b"\0"
845
846
847def test_parquet_compression_roundtrip(tempdir):

Callers

nothing calls this directly

Calls 4

seekMethod · 0.80
buffersMethod · 0.80
write_tableMethod · 0.45
read_tableMethod · 0.45

Tested by

no test coverage detected