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

Function _check_dataset_roundtrip

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

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