Package org.apache.beam.sdk.io.iceberg
Class BeamRowWrapper
java.lang.Object
org.apache.beam.sdk.io.iceberg.BeamRowWrapper
- All Implemented Interfaces:
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
ConstructorsConstructorDescriptionBeamRowWrapper(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 TypeMethodDescription<T> @Nullable TRetrieves 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> voidset(int pos, T value) intsize()Sets the current BeamRowto be wrapped.
-
Constructor Details
-
BeamRowWrapper
Constructs a new wrapper and pre-computes the mapping between Beam and Iceberg fields.
-
-
Method Details
-
wrap
Sets the current BeamRowto be wrapped. This method allows the wrapper to be reused across different rows to minimize object allocation. -
size
public int size()- Specified by:
sizein interfaceorg.apache.iceberg.StructLike
-
get
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:
getin interfaceorg.apache.iceberg.StructLike
-
set
public <T> void set(int pos, T value) - Specified by:
setin interfaceorg.apache.iceberg.StructLike
-