code: def test_udf_via_substrait(unary_func_fixture, use_threads):
      test_table = pa.Table.from_pydict({"x": [1, 2, 3]})
  
      def table_provider(names, _):
          if not names:
              raise Exception("No names provided")
          elif names[0] == "t1":
              return test_table
          else:
              raise Exception("Unrecognized table name")
  
      substrait_query = b"""
      {
    "extensionUris": [
      {
        "extensionUriAnchor": 1
      },
      {
        "extensionUriAnchor": 2,
        "uri": "urn:arrow:substrait_simple_extension_function"
      }
    ],
    "extensions": [
      {
        "extensionFunction": {
          "extensionUriReference": 2,
          "functionAnchor": 1,
          "name": "y=x+1"
        }
      }
    ],
    "relations": [
      {
        "root": {
          "input": {
            "project": {
              "common": {
                "emit": {
                  "outputMapping": [
                    1,
                    2,
                  ]
                }
              },
              "input": {
                "read": {
                  "baseSchema": {
                    "names": [
                      "t",
                    ],
                    "struct": {
                      "types": [
                        {
                          "i64": {
                            "nullability": "NULLABILITY_REQUIRED"
                          }
                        },
                      ],
                      "nullability": "NULLABILITY_REQUIRED"
                    }
                  },
                  "namedTable": {
                    "names": [
                      "t1"
                    ]
                  }
                }
              },
              "expressions": [
                {
                  "selection": {
                    "directReference": {
                      "structField": {}
                    },
                    "rootReference": {}
                  }
                },
                {
                  "scalarFunction": {
                    "functionReference": 1,
                    "outputType": {
                      "i64": {
                        "nullability": "NULLABILITY_NULLABLE"
                      }
                    },
                    "arguments": [
                      {
                        "value": {
                          "selection": {
                            "directReference": {
                              "structField": {}
                            },
                            "rootReference": {}
                          }
                        }
                      }
                    ]
                  }
                }
              ]
            }
          },
          "names": [
            "x",
            "y",
          ]
        }
      }
    ]
  }
      """
  
      buf = pa._substrait._parse_json_plan(substrait_query)
      reader = pa.substrait.run_query(
          buf, table_provider=table_provider, use_threads=use_threads
      )
      res_tb = reader.read_all()
  
      function, name = unary_func_fixture
      expected_tb = test_table.add_column(
          1, "y", function(mock_udf_context(10), test_table["x"])
      )
      assert res_tb == expected_tb
  
imports: import os
  import pathlib
  import pytest
  import pyarrow
  import pyarrow.compute
  from pyarrow.lib import tobytes
  from pyarrow.lib import ArrowInvalid, ArrowNotImplementedError
label_desc: Use image node_id 12 for calling a global function with example usage: test_udf_via_substrait(unary_func_fixture, use_threads) and returns: test_table