(tmpdir, use_threads)
| 49 | |
| 50 | @pytest.mark.parametrize("use_threads", [True, False]) |
| 51 | def test_run_serialized_query(tmpdir, use_threads): |
| 52 | substrait_query = """ |
| 53 | { |
| 54 | "version": { "major": 9999 }, |
| 55 | "relations": [ |
| 56 | {"rel": { |
| 57 | "read": { |
| 58 | "base_schema": { |
| 59 | "struct": { |
| 60 | "types": [ |
| 61 | {"i64": {}} |
| 62 | ] |
| 63 | }, |
| 64 | "names": [ |
| 65 | "foo" |
| 66 | ] |
| 67 | }, |
| 68 | "local_files": { |
| 69 | "items": [ |
| 70 | { |
| 71 | "uri_file": "FILENAME_PLACEHOLDER", |
| 72 | "arrow": {} |
| 73 | } |
| 74 | ] |
| 75 | } |
| 76 | } |
| 77 | }} |
| 78 | ] |
| 79 | } |
| 80 | """ |
| 81 | |
| 82 | file_name = "read_data.arrow" |
| 83 | table = pa.table([[1, 2, 3, 4, 5]], names=['foo']) |
| 84 | path = _write_dummy_data_to_disk(tmpdir, file_name, table) |
| 85 | query = tobytes(substrait_query.replace( |
| 86 | "FILENAME_PLACEHOLDER", pathlib.Path(path).as_uri())) |
| 87 | |
| 88 | buf = pa._substrait._parse_json_plan(query) |
| 89 | |
| 90 | reader = substrait.run_query(buf, use_threads=use_threads) |
| 91 | res_tb = reader.read_all() |
| 92 | |
| 93 | assert table.select(["foo"]) == res_tb.select(["foo"]) |
| 94 | |
| 95 | |
| 96 | @pytest.mark.parametrize("query", (pa.py_buffer(b'buffer'), b"bytes", 1)) |
nothing calls this directly
no test coverage detected