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

Function test_read_options_included_fields

python/pyarrow/tests/test_ipc.py:592–614  ·  view source on GitHub ↗
(stream_fixture)

Source from the content-addressed store, hash-verified

590
591
592def test_read_options_included_fields(stream_fixture):
593 options1 = pa.ipc.IpcReadOptions()
594 options2 = pa.ipc.IpcReadOptions(included_fields=[1])
595 table = pa.Table.from_arrays([pa.array(['foo', 'bar', 'baz', 'qux']),
596 pa.array([1, 2, 3, 4])],
597 names=['a', 'b'])
598 with stream_fixture._get_writer(stream_fixture.sink, table.schema) as wr:
599 wr.write_table(table)
600 source = stream_fixture.get_source()
601
602 reader1 = pa.ipc.open_stream(source, options=options1)
603 reader2 = pa.ipc.open_stream(
604 source, options=options2, memory_pool=pa.system_memory_pool())
605
606 result1 = reader1.read_all()
607 result2 = reader2.read_all()
608
609 assert result1.num_columns == 2
610 assert result2.num_columns == 1
611
612 expected = pa.Table.from_arrays([pa.array([1, 2, 3, 4])], names=["b"])
613 assert result2 == expected
614 assert result1 == table
615
616
617def test_dictionary_delta(format_fixture):

Callers

nothing calls this directly

Calls 5

get_sourceMethod · 0.80
system_memory_poolMethod · 0.80
arrayMethod · 0.45
_get_writerMethod · 0.45
write_tableMethod · 0.45

Tested by

no test coverage detected