code: def test_registration_errors():
      # validate function name
      doc = {
          "summary": "test udf input",
          "description": "parameters are validated",
      }
      in_types = {"scalar": pa.int64()}
      out_type = pa.int64()
  
      def test_reg_function(context):
          return pa.array([10])
  
      with pytest.raises(TypeError):
          pc.register_scalar_function(
              test_reg_function, None, doc, in_types, out_type
          )
  
      # validate function
      with pytest.raises(TypeError, match="func must be a callable"):
          pc.register_scalar_function(
              None, "test_none_function", doc, in_types, out_type
          )
  
      # validate output type
      expected_expr = "DataType expected, got <class 'NoneType'>"
      with pytest.raises(TypeError, match=expected_expr):
          pc.register_scalar_function(
              test_reg_function,
              "test_output_function",
              doc,
              in_types,
              None,
          )
  
      # validate input type
      expected_expr = "in_types must be a dictionary of DataType"
      with pytest.raises(TypeError, match=expected_expr):
          pc.register_scalar_function(
              test_reg_function,
              "test_input_function",
              doc,
              None,
              out_type,
          )
  
      # register an already registered function
      # first registration
      pc.register_scalar_function(
          test_reg_function, "test_reg_function", doc, {}, out_type
      )
      # second registration
      expected_expr = (
          "Already have a function registered with name:"
          + " test_reg_function"
      )
      with pytest.raises(KeyError, match=expected_expr):
          pc.register_scalar_function(
              test_reg_function, "test_reg_function", doc, {}, out_type
          )
  
imports: import pytest
  import numpy
  import pyarrow
  from pyarrow import compute
label_desc: Use image node_id 21 for calling a global function with example usage: test_registration_errors() and returns: pa