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

Function test_write_dataset_partitioned

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

Source from the content-addressed store, hash-verified

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