| 567 | |
| 568 | @pytest.mark.parametrize("use_threads", [True, False]) |
| 569 | def test_output_field_names(use_threads): |
| 570 | in_table = pa.Table.from_pydict({"x": [1, 2, 3]}) |
| 571 | |
| 572 | def table_provider(names, schema): |
| 573 | return in_table |
| 574 | |
| 575 | substrait_query = """ |
| 576 | { |
| 577 | "version": { "major": 9999 }, |
| 578 | "relations": [ |
| 579 | { |
| 580 | "root": { |
| 581 | "input": { |
| 582 | "read": { |
| 583 | "base_schema": { |
| 584 | "struct": { |
| 585 | "types": [{"i64": {}}] |
| 586 | }, |
| 587 | "names": ["x"] |
| 588 | }, |
| 589 | "namedTable": { |
| 590 | "names": ["t1"] |
| 591 | } |
| 592 | } |
| 593 | }, |
| 594 | "names": ["out"] |
| 595 | } |
| 596 | } |
| 597 | ] |
| 598 | } |
| 599 | """ |
| 600 | |
| 601 | buf = pa._substrait._parse_json_plan(tobytes(substrait_query)) |
| 602 | reader = pa.substrait.run_query( |
| 603 | buf, table_provider=table_provider, use_threads=use_threads) |
| 604 | res_tb = reader.read_all() |
| 605 | |
| 606 | expected = pa.Table.from_pydict({"out": [1, 2, 3]}) |
| 607 | |
| 608 | assert res_tb == expected |
| 609 | |
| 610 | |
| 611 | @pytest.mark.numpy |