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

Function test_orc_scan_options

python/pyarrow/tests/test_dataset.py:3436–3455  ·  view source on GitHub ↗
(tempdir, dataset_reader)

Source from the content-addressed store, hash-verified

3434
3435@pytest.mark.orc
3436def test_orc_scan_options(tempdir, dataset_reader):
3437 from pyarrow import orc
3438 table = pa.table({'a': pa.array([1, 2, 3], type="int8"),
3439 'b': pa.array([.1, .2, .3], type="float64")})
3440
3441 path = str(tempdir / 'test.orc')
3442 orc.write_table(table, path)
3443
3444 dataset = ds.dataset(path, format="orc")
3445 result = list(dataset_reader.to_batches(dataset))
3446 assert len(result) == 1
3447 assert result[0].num_rows == 3
3448 assert result[0].equals(table.to_batches()[0])
3449
3450 result = list(dataset_reader.to_batches(dataset, batch_size=2))
3451 assert len(result) == 2
3452 assert result[0].num_rows == 2
3453 assert result[0].equals(table.slice(0, 2).to_batches()[0])
3454 assert result[1].num_rows == 1
3455 assert result[1].equals(table.slice(2, 1).to_batches()[0])
3456
3457
3458def test_orc_format_not_supported():

Callers

nothing calls this directly

Calls 7

listFunction · 0.85
lenFunction · 0.85
to_batchesMethod · 0.80
equalsMethod · 0.80
arrayMethod · 0.45
write_tableMethod · 0.45
sliceMethod · 0.45

Tested by

no test coverage detected