Interface RowBridge<T>

Type Parameters:
T - the row type the bridge converts
All Known Implementing Classes:
AvroRowBridge, JsonRowBridge, ProtobufRowBridge

public interface RowBridge<T>
Converts typed rows to and from an Arrow payload batch.

A bridge defines how a Java value type maps onto Arrow columns; RowCodec combines it with a Kafka serde to turn ordinary records into batches. Row order and count must be preserved in both directions so metadata columns stay aligned with their rows. JsonRowBridge is the bundled implementation for JSON-compatible types.

Example

RowBridge<Transaction> bridge = new JsonRowBridge<>(Transaction.class);
try (var batch = bridge.rowsToBatch(transactions, allocator)) {
    List<Transaction> roundTripped = bridge.batchToRows(batch);
}
  • Method Summary

    Modifier and Type
    Method
    Description
    batchToRows(org.apache.arrow.vector.VectorSchemaRoot batch)
    Converts an Arrow payload batch back into one value per row.
    org.apache.arrow.vector.VectorSchemaRoot
    rowsToBatch(List<T> rows, org.apache.arrow.memory.BufferAllocator allocator)
    Builds one Arrow batch with one row per value.
  • Method Details

    • rowsToBatch

      org.apache.arrow.vector.VectorSchemaRoot rowsToBatch(List<T> rows, org.apache.arrow.memory.BufferAllocator allocator)
      Builds one Arrow batch with one row per value.
      Parameters:
      rows - the values to convert, in record order
      allocator - the allocator that owns the batch's buffers
      Returns:
      the payload batch; the caller must close it
    • batchToRows

      List<T> batchToRows(org.apache.arrow.vector.VectorSchemaRoot batch)
      Converts an Arrow payload batch back into one value per row.
      Parameters:
      batch - the payload batch to convert; the bridge reads it and leaves it open
      Returns:
      the values in row order