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

Function test_write_dataset_partitioned

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

Source from the content-addressed store, hash-verified

4256@pytest.mark.parquet
4257@pytest.mark.pandas
4258def test_write_dataset_partitioned(tempdir):
4259 directory = tempdir / "partitioned"
4260 _ = _create_parquet_dataset_partitioned(directory)
4261 partitioning = ds.partitioning(flavor="hive")
4262 dataset = ds.dataset(directory, partitioning=partitioning)
4263
4264 # hive partitioning
4265 target = tempdir / 'partitioned-hive-target'
4266 expected_paths = [
4267 target / "part=a", target / "part=a" / "part-0.arrow",
4268 target / "part=b", target / "part=b" / "part-0.arrow"
4269 ]
4270 partitioning_schema = ds.partitioning(
4271 pa.schema([("part", pa.string())]), flavor="hive")
4272 _check_dataset_roundtrip(
4273 dataset, str(target), expected_paths, 'f1', target,
4274 partitioning=partitioning_schema)
4275
4276 # directory partitioning
4277 target = tempdir / 'partitioned-dir-target'
4278 expected_paths = [
4279 target / "a", target / "a" / "part-0.arrow",
4280 target / "b", target / "b" / "part-0.arrow"
4281 ]
4282 partitioning_schema = ds.partitioning(
4283 pa.schema([("part", pa.string())]))
4284 _check_dataset_roundtrip(
4285 dataset, str(target), expected_paths, 'f1', target,
4286 partitioning=partitioning_schema)
4287
4288
4289def test_write_dataset_with_field_names(tempdir):

Callers

nothing calls this directly

Calls 5

_check_dataset_roundtripFunction · 0.85
partitioningMethod · 0.80
schemaMethod · 0.45
stringMethod · 0.45

Tested by

no test coverage detected