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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

scannerMethod · 0.80
to_tableMethod · 0.45

Tested by

no test coverage detected