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

Function _check_dataset_roundtrip

python/pyarrow/tests/test_dataset.py:4198–4214  ·  view source on GitHub ↗
(dataset, base_dir, expected_files, sort_col,
                             base_dir_path=None, partitioning=None)

Source from the content-addressed store, hash-verified

4196
4197
4198def _check_dataset_roundtrip(dataset, base_dir, expected_files, sort_col,
4199 base_dir_path=None, partitioning=None):
4200 base_dir_path = base_dir_path or base_dir
4201
4202 ds.write_dataset(dataset, base_dir, format="arrow",
4203 partitioning=partitioning, use_threads=False)
4204
4205 # check that all files are present
4206 file_paths = list(base_dir_path.rglob("*"))
4207 assert set(file_paths) == set(expected_files)
4208
4209 # check that reading back in as dataset gives the same result
4210 dataset2 = ds.dataset(
4211 base_dir_path, format="arrow", partitioning=partitioning)
4212
4213 assert _sort_table(dataset2.to_table(), sort_col).equals(
4214 _sort_table(dataset.to_table(), sort_col))
4215
4216
4217@pytest.mark.parquet

Callers 3

test_write_datasetFunction · 0.85

Calls 4

listFunction · 0.85
_sort_tableFunction · 0.85
equalsMethod · 0.80
to_tableMethod · 0.45

Tested by

no test coverage detected