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