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

Function test_scanner_from_substrait

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

Source from the content-addressed store, hash-verified

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