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

Function test_construct_in_memory

python/pyarrow/tests/test_dataset.py:2680–2694  ·  view source on GitHub ↗
(dataset_reader)

Source from the content-addressed store, hash-verified

2678
2679
2680def test_construct_in_memory(dataset_reader):
2681 batch = pa.RecordBatch.from_arrays([pa.array(range(10))], names=["a"])
2682 reader = pa.RecordBatchReader.from_batches(batch.schema, [batch])
2683 table = pa.Table.from_batches([batch])
2684
2685 dataset_table = ds.dataset([], format='ipc', schema=pa.schema([])
2686 ).to_table()
2687 assert dataset_table == pa.table([])
2688
2689 for source in (batch, table, [batch], [table], reader):
2690 dataset = ds.dataset(source)
2691 assert dataset_reader.to_table(dataset) == table
2692 assert len(list(dataset.get_fragments())) == 1
2693 assert next(dataset.get_fragments()).to_table() == table
2694 assert pa.Table.from_batches(list(dataset.to_batches())) == table
2695
2696
2697@pytest.mark.parametrize('use_threads', [False, True])

Callers

nothing calls this directly

Calls 6

lenFunction · 0.85
listFunction · 0.85
to_batchesMethod · 0.80
arrayMethod · 0.45
to_tableMethod · 0.45
schemaMethod · 0.45

Tested by

no test coverage detected