Class BeamRowWrapper

java.lang.Object
org.apache.beam.sdk.io.iceberg.BeamRowWrapper
All Implemented Interfaces:
org.apache.iceberg.StructLike

public class BeamRowWrapper extends Object implements org.apache.iceberg.StructLike
A wrapper that adapts a Beam Row to Iceberg's StructLike interface.

This class allows Beam rows to be processed by Iceberg internal components (like partition keys or writers) without requiring a full conversion into Iceberg's internal Record format. It handles the mapping between Beam's Schema and Iceberg's Types.StructType, including complex type conversions for timestamps, logical types, and UUIDs.

Note: This implementation is read-only. Calls to set(int, Object) will throw an UnsupportedOperationException.

  • Constructor Summary

    Constructors
    Constructor
    Description
    BeamRowWrapper(Schema schema, org.apache.iceberg.types.Types.StructType struct)
    Constructs a new wrapper and pre-computes the mapping between Beam and Iceberg fields.
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> @Nullable T
    get(int pos, Class<T> javaClass)
    Retrieves a field value from the wrapped row, performing any necessary type conversion to match Iceberg's internal expectations (e.g., converting Timestamps to microseconds).
    <T> void
    set(int pos, T value)
     
    int
     
    Sets the current Beam Row to be wrapped.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BeamRowWrapper

      public BeamRowWrapper(Schema schema, org.apache.iceberg.types.Types.StructType struct)
      Constructs a new wrapper and pre-computes the mapping between Beam and Iceberg fields.
  • Method Details

    • wrap

      public BeamRowWrapper wrap(@Nullable Row row)
      Sets the current Beam Row to be wrapped. This method allows the wrapper to be reused across different rows to minimize object allocation.
    • size

      public int size()
      Specified by:
      size in interface org.apache.iceberg.StructLike
    • get

      public <T> @Nullable T get(int pos, Class<T> javaClass)
      Retrieves a field value from the wrapped row, performing any necessary type conversion to match Iceberg's internal expectations (e.g., converting Timestamps to microseconds).
      Specified by:
      get in interface org.apache.iceberg.StructLike
    • set

      public <T> void set(int pos, T value)
      Specified by:
      set in interface org.apache.iceberg.StructLike