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

Function test_write_dataset_partitioned

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

Source from the content-addressed store, hash-verified

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