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

Function test_output_field_names

python/pyarrow/tests/test_substrait.py:569–608  ·  view source on GitHub ↗
(use_threads)

Source from the content-addressed store, hash-verified

567
568@pytest.mark.parametrize("use_threads", [True, False])
569def 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

Callers

nothing calls this directly

Calls 1

tobytesFunction · 0.85

Tested by

no test coverage detected