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

Function test_scanner_from_substrait

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

Source from the content-addressed store, hash-verified

5970
5971@pytest.mark.substrait
5972def test_scanner_from_substrait(dataset):
5973 try:
5974 import pyarrow.substrait as ps
5975 except ImportError:
5976 pytest.skip("substrait NOT enabled")
5977
5978 # SELECT str WHERE i64 = 4
5979 projection = (b'\nS\x08\x0c\x12Ohttps://github.com/apache/arrow/blob/main/format'
5980 b'/substrait/extension_types.yaml\x12\t\n\x07\x08\x0c\x1a\x03u64'
5981 b'\x12\x0b\n\t\x08\x0c\x10\x01\x1a\x03u32\x1a\x0f\n\x08\x12\x06'
5982 b'\n\x04\x12\x02\x08\x02\x1a\x03str"i\n\x03i64\n\x03f64\n\x03str'
5983 b'\n\x05const\n\x06struct\n\x01a\n\x01b\n\x05group\n\x03key'
5984 b'\x127\n\x04:\x02\x10\x01\n\x04Z\x02\x10\x01\n\x04b\x02\x10'
5985 b'\x01\n\x04:\x02\x10\x01\n\x11\xca\x01\x0e\n\x04:\x02\x10\x01'
5986 b'\n\x04b\x02\x10\x01\x18\x01\n\x04*\x02\x10\x01\n\x04b\x02\x10\x01')
5987 filtering = (b'\n\x1e\x08\x06\x12\x1a/functions_comparison.yaml\nS\x08\x0c\x12'
5988 b'Ohttps://github.com/apache/arrow/blob/main/format'
5989 b'/substrait/extension_types.yaml\x12\x18\x1a\x16\x08\x06\x10\xc5'
5990 b'\x01\x1a\x0fequal:any1_any1\x12\t\n\x07\x08\x0c\x1a\x03u64\x12'
5991 b'\x0b\n\t\x08\x0c\x10\x01\x1a\x03u32\x1a\x1f\n\x1d\x1a\x1b\x08'
5992 b'\xc5\x01\x1a\x04\n\x02\x10\x02"\x08\x1a\x06\x12\x04\n\x02\x12\x00'
5993 b'"\x06\x1a\x04\n\x02(\x04"i\n\x03i64\n\x03f64\n\x03str\n\x05const'
5994 b'\n\x06struct\n\x01a\n\x01b\n\x05group\n\x03key\x127\n\x04:\x02'
5995 b'\x10\x01\n\x04Z\x02\x10\x01\n\x04b\x02\x10\x01\n\x04:\x02\x10'
5996 b'\x01\n\x11\xca\x01\x0e\n\x04:\x02\x10\x01\n\x04b\x02\x10\x01'
5997 b'\x18\x01\n\x04*\x02\x10\x01\n\x04b\x02\x10\x01')
5998
5999 result = dataset.scanner(
6000 columns=ps.BoundExpressions.from_substrait(projection),
6001 filter=ps.BoundExpressions.from_substrait(filtering)
6002 ).to_table()
6003 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