code: def field(jvm_field):
      """
      Construct a Field from a org.apache.arrow.vector.types.pojo.Field
      instance.
  
      Parameters
      ----------
      jvm_field: org.apache.arrow.vector.types.pojo.Field
  
      Returns
      -------
      pyarrow.Field
      """
      name = str(jvm_field.getName())
      jvm_type = jvm_field.getType()
  
      typ = None
      if not jvm_type.isComplex():
          type_str = jvm_type.getTypeID().toString()
          if type_str == "Null":
              typ = pa.null()
          elif type_str == "Int":
              typ = _from_jvm_int_type(jvm_type)
          elif type_str == "FloatingPoint":
              typ = _from_jvm_float_type(jvm_type)
          elif type_str == "Utf8":
              typ = pa.string()
          elif type_str == "Binary":
              typ = pa.binary()
          elif type_str == "FixedSizeBinary":
              typ = pa.binary(jvm_type.getByteWidth())
          elif type_str == "Bool":
              typ = pa.bool_()
          elif type_str == "Time":
              typ = _from_jvm_time_type(jvm_type)
          elif type_str == "Timestamp":
              typ = _from_jvm_timestamp_type(jvm_type)
          elif type_str == "Date":
              typ = _from_jvm_date_type(jvm_type)
          elif type_str == "Decimal":
              typ = pa.decimal128(
                  jvm_type.getPrecision(), jvm_type.getScale()
              )
          else:
              raise NotImplementedError(
                  "Unsupported JVM type: {}".format(type_str)
              )
      else:
          # TODO: The following JVM types are not implemented:
          #       Struct, List, FixedSizeList, Union, Dictionary
          raise NotImplementedError(
              "JVM field conversion only implemented for primitive types."
          )
  
      nullable = jvm_field.isNullable()
      jvm_metadata = jvm_field.getMetadata()
      if jvm_metadata.isEmpty():
          metadata = None
      else:
          metadata = {
              str(entry.getKey()): str(entry.getValue())
              for entry in jvm_metadata.entrySet()
          }
      return pa.field(name, typ, nullable, metadata)
  
file_path: arrow/python/pyarrow/jvm.py
imports: import pyarrow
label_desc: Use image node_id 7 for calling a global function with example usage: field(jvm_field) and returns: pa