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

Function test_scanner_from_substrait

python/pyarrow/tests/test_dataset.py:5912–5943  ·  view source on GitHub ↗
(dataset)

Source from the content-addressed store, hash-verified

5910
5911@pytest.mark.substrait
5912def test_scanner_from_substrait(dataset):
5913 try:
5914 import pyarrow.substrait as ps
5915 except ImportError:
5916 pytest.skip("substrait NOT enabled")
5917
5918 # SELECT str WHERE i64 = 4
5919 projection = (b'\nS\x08\x0c\x12Ohttps://github.com/apache/arrow/blob/main/format'
5920 b'/substrait/extension_types.yaml\x12\t\n\x07\x08\x0c\x1a\x03u64'
5921 b'\x12\x0b\n\t\x08\x0c\x10\x01\x1a\x03u32\x1a\x0f\n\x08\x12\x06'
5922 b'\n\x04\x12\x02\x08\x02\x1a\x03str"i\n\x03i64\n\x03f64\n\x03str'
5923 b'\n\x05const\n\x06struct\n\x01a\n\x01b\n\x05group\n\x03key'
5924 b'\x127\n\x04:\x02\x10\x01\n\x04Z\x02\x10\x01\n\x04b\x02\x10'
5925 b'\x01\n\x04:\x02\x10\x01\n\x11\xca\x01\x0e\n\x04:\x02\x10\x01'
5926 b'\n\x04b\x02\x10\x01\x18\x01\n\x04*\x02\x10\x01\n\x04b\x02\x10\x01')
5927 filtering = (b'\n\x1e\x08\x06\x12\x1a/functions_comparison.yaml\nS\x08\x0c\x12'
5928 b'Ohttps://github.com/apache/arrow/blob/main/format'
5929 b'/substrait/extension_types.yaml\x12\x18\x1a\x16\x08\x06\x10\xc5'
5930 b'\x01\x1a\x0fequal:any1_any1\x12\t\n\x07\x08\x0c\x1a\x03u64\x12'
5931 b'\x0b\n\t\x08\x0c\x10\x01\x1a\x03u32\x1a\x1f\n\x1d\x1a\x1b\x08'
5932 b'\xc5\x01\x1a\x04\n\x02\x10\x02"\x08\x1a\x06\x12\x04\n\x02\x12\x00'
5933 b'"\x06\x1a\x04\n\x02(\x04"i\n\x03i64\n\x03f64\n\x03str\n\x05const'
5934 b'\n\x06struct\n\x01a\n\x01b\n\x05group\n\x03key\x127\n\x04:\x02'
5935 b'\x10\x01\n\x04Z\x02\x10\x01\n\x04b\x02\x10\x01\n\x04:\x02\x10'
5936 b'\x01\n\x11\xca\x01\x0e\n\x04:\x02\x10\x01\n\x04b\x02\x10\x01'
5937 b'\x18\x01\n\x04*\x02\x10\x01\n\x04b\x02\x10\x01')
5938
5939 result = dataset.scanner(
5940 columns=ps.BoundExpressions.from_substrait(projection),
5941 filter=ps.BoundExpressions.from_substrait(filtering)
5942 ).to_table()
5943 assert result.to_pydict() == {'str': ['4', '4']}

Callers

nothing calls this directly

Calls 2

scannerMethod · 0.80
to_tableMethod · 0.45

Tested by

no test coverage detected