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:3873–3891  ·  view source on GitHub ↗
(tempdir)

Source from the content-addressed store, hash-verified

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