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:4323–4339  ·  view source on GitHub ↗
(tempdir)

Source from the content-addressed store, hash-verified

4321
4322
4323def 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

Callers

nothing calls this directly

Calls 2

scannerMethod · 0.80
to_tableMethod · 0.45

Tested by

no test coverage detected