code: def test_table():
      import pyarrow.gandiva as gandiva
  
      table = pa.Table.from_arrays(
          [pa.array([1.0, 2.0]), pa.array([3.0, 4.0])], ["a", "b"]
      )
  
      builder = gandiva.TreeExprBuilder()
      node_a = builder.make_field(table.schema.field("a"))
      node_b = builder.make_field(table.schema.field("b"))
  
      sum = builder.make_function("add", [node_a, node_b], pa.float64())
  
      field_result = pa.field("c", pa.float64())
      expr = builder.make_expression(sum, field_result)
  
      projector = gandiva.make_projector(
          table.schema, [expr], pa.default_memory_pool()
      )
  
      # TODO: Add .evaluate function which can take Tables instead of
      # RecordBatches
      (r,) = projector.evaluate(table.to_batches()[0])
  
      e = pa.array([4.0, 6.0])
      assert r.equals(e)
  
file_path: arrow/python/pyarrow/tests/test_gandiva.py
imports: import datetime
  import pytest
  import pyarrow
label_desc: Use image node_id 2 for calling a global function with example usage: test_table() without return types