| 4325 | |
| 4326 | |
| 4327 | def test_write_dataset_with_scanner(tempdir): |
| 4328 | table = pa.table({'a': ['x', 'y', None], 'b': ['x', 'y', 'z'], |
| 4329 | 'c': [1, 2, 3]}) |
| 4330 | |
| 4331 | ds.write_dataset(table, tempdir, format='ipc', |
| 4332 | partitioning=["b"]) |
| 4333 | |
| 4334 | dataset = ds.dataset(tempdir, format='ipc', partitioning=["b"]) |
| 4335 | |
| 4336 | with tempfile.TemporaryDirectory() as tempdir2: |
| 4337 | ds.write_dataset(dataset.scanner(columns=["b", "c"]), |
| 4338 | tempdir2, format='ipc', partitioning=["b"]) |
| 4339 | |
| 4340 | load_back = ds.dataset(tempdir2, format='ipc', partitioning=["b"]) |
| 4341 | load_back_table = load_back.to_table() |
| 4342 | assert dict(load_back_table.to_pydict() |
| 4343 | ) == table.drop_columns("a").to_pydict() |
| 4344 | |
| 4345 | |
| 4346 | @pytest.mark.parquet |