(tempdir)
| 1217 | |
| 1218 | |
| 1219 | def 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 | |
| 1243 | def test_parquet_dataset_new_filesystem(tempdir): |
nothing calls this directly
no test coverage detected