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

Function test_dataset_partitioning

python/pyarrow/tests/parquet/test_dataset.py:1219–1240  ·  view source on GitHub ↗
(tempdir)

Source from the content-addressed store, hash-verified

1217
1218
1219def test_dataset_partitioning(tempdir):
1220 import pyarrow.dataset as ds
1221
1222 # create small dataset with directory partitioning
1223 root_path = tempdir / "test_partitioning"
1224 (root_path / "2012" / "10" / "01").mkdir(parents=True)
1225
1226 table = pa.table({'a': [1, 2, 3]})
1227 pq.write_table(
1228 table, str(root_path / "2012" / "10" / "01" / "data.parquet"))
1229
1230 # This works with new dataset API
1231
1232 # read_table
1233 part = ds.partitioning(field_names=["year", "month", "day"])
1234 result = pq.read_table(
1235 str(root_path), partitioning=part)
1236 assert result.column_names == ["a", "year", "month", "day"]
1237
1238 result = pq.ParquetDataset(
1239 str(root_path), partitioning=part).read()
1240 assert result.column_names == ["a", "year", "month", "day"]
1241
1242
1243def test_parquet_dataset_new_filesystem(tempdir):

Callers

nothing calls this directly

Calls 4

partitioningMethod · 0.80
write_tableMethod · 0.45
read_tableMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected