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