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

Function _check_dataset_roundtrip

python/pyarrow/tests/test_dataset.py:4201–4217  ·  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

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