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

Function test_write_dataset_with_scanner

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

scannerMethod · 0.80
to_tableMethod · 0.45

Tested by

no test coverage detected