iceberg-cpp
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
iceberg::ArrowRowBuilder Class Reference

Movable RAII builder that materializes rows into an Arrow struct array. More...

#include <arrow_row_builder_internal.h>

Public Member Functions

 ArrowRowBuilder (ArrowRowBuilder &&other) noexcept
 
ArrowRowBuilderoperator= (ArrowRowBuilder &&other) noexcept
 
 ArrowRowBuilder (const ArrowRowBuilder &)=delete
 
ArrowRowBuilderoperator= (const ArrowRowBuilder &)=delete
 
int64_t num_columns () const
 The number of top-level columns in the batch.
 
ArrowArraycolumn (int64_t index)
 Access the nanoarrow child builder for a top-level column.
 
Status FinishRow ()
 Finish the current row, advancing the struct length by one.
 
Result< ArrowArrayFinish () &&
 Finish building and transfer ownership of the resulting array.
 

Static Public Member Functions

static Result< ArrowRowBuilderMake (const Schema &schema)
 Create a row builder from an Iceberg schema.
 
static Result< ArrowRowBuilderMake (const ArrowSchema *schema)
 Create a row builder from an ArrowSchema.
 

Detailed Description

Movable RAII builder that materializes rows into an Arrow struct array.

Handles the nanoarrow lifecycle: InitFromSchema → StartAppending → ... append values ... → FinishBuilding → Release.

Two constructors:

Typical usage:

ICEBERG_ASSIGN_OR_RAISE(auto builder, ArrowRowBuilder::Make(schema));
for (const auto& row : rows) {
ICEBERG_RETURN_UNEXPECTED(AppendInt(builder.column(0), row.id));
ICEBERG_RETURN_UNEXPECTED(AppendString(builder.column(1), row.name));
ICEBERG_RETURN_UNEXPECTED(builder.FinishRow());
}
ICEBERG_ASSIGN_OR_RAISE(auto array, std::move(builder).Finish());
static Result< ArrowRowBuilder > Make(const Schema &schema)
Create a row builder from an Iceberg schema.
Definition arrow_row_builder.cc:34
Result< ArrowArray > Finish() &&
Finish building and transfer ownership of the resulting array.
Definition arrow_row_builder.cc:90

Member Function Documentation

◆ column()

ArrowArray * iceberg::ArrowRowBuilder::column ( int64_t  index)

Access the nanoarrow child builder for a top-level column.

Parameters
indexZero-based column index. Returns nullptr if out of range.

◆ Finish()

Result< ArrowArray > iceberg::ArrowRowBuilder::Finish ( ) &&

Finish building and transfer ownership of the resulting array.

The builder must not be used after this call.

◆ FinishRow()

Status iceberg::ArrowRowBuilder::FinishRow ( )

Finish the current row, advancing the struct length by one.

Call after appending exactly one value (or null) to every column.

◆ Make()

Result< ArrowRowBuilder > iceberg::ArrowRowBuilder::Make ( const ArrowSchema schema)
static

Create a row builder from an ArrowSchema.

The schema must outlive this call (the caller guards it). On failure the partially-initialized array is released automatically.


The documentation for this class was generated from the following files: