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

Function test_parquet_dataset_factory_order

python/pyarrow/tests/test_dataset.py:3880–3898  ·  view source on GitHub ↗
(tempdir)

Source from the content-addressed store, hash-verified

3878
3879@pytest.mark.parquet
3880def test_parquet_dataset_factory_order(tempdir):
3881 # The order of the fragments in the dataset should match the order of the
3882 # row groups in the _metadata file.
3883 metadatas = []
3884 # Create a dataset where f1 is incrementing from 0 to 100 spread across
3885 # 10 files. Put the row groups in the correct order in _metadata
3886 for i in range(10):
3887 table = pa.table(
3888 {'f1': list(range(i*10, (i+1)*10))})
3889 table_path = tempdir / f'{i}.parquet'
3890 pq.write_table(table, table_path, metadata_collector=metadatas)
3891 metadatas[-1].set_file_path(f'{i}.parquet')
3892 metadata_path = str(tempdir / '_metadata')
3893 pq.write_metadata(table.schema, metadata_path, metadatas)
3894 dataset = ds.parquet_dataset(metadata_path)
3895 # Ensure the table contains values from 0-100 in the right order
3896 scanned_table = dataset.to_table()
3897 scanned_col = scanned_table.column('f1').to_pylist()
3898 assert scanned_col == list(range(0, 100))
3899
3900
3901@pytest.mark.parquet

Callers

nothing calls this directly

Calls 5

listFunction · 0.85
write_tableMethod · 0.45
set_file_pathMethod · 0.45
to_tableMethod · 0.45
columnMethod · 0.45

Tested by

no test coverage detected