Signet Forge 0.1.0
C++20 Parquet library with AI-native extensions
DEMO
Loading...
Searching...
No Matches
signet::forge::ArrowExporter Class Reference

Exports Signet Forge tensors and columns as Arrow C Data Interface structs. More...

#include <arrow_bridge.hpp>

Static Public Member Functions

static expected< void > export_tensor (const TensorView &tensor, const std::string &name, ArrowArray *out_array, ArrowSchema *out_schema)
 Export a TensorView as an ArrowArray + ArrowSchema pair (zero-copy).
 
static expected< void > export_column (const void *data, int64_t num_values, PhysicalType physical_type, const std::string &name, ArrowArray *out_array, ArrowSchema *out_schema)
 Export a 1D column of a primitive Parquet type as ArrowArray + ArrowSchema (zero-copy).
 

Detailed Description

Exports Signet Forge tensors and columns as Arrow C Data Interface structs.

For numeric types this is zero-copy: the ArrowArray.buffers[1] pointer is set directly to the source data. The source data must remain valid for the entire lifetime of the exported ArrowArray.

The caller is responsible for calling the release() callbacks on both the ArrowArray and ArrowSchema when done.

Note
All exported arrays are non-nullable (null_count = 0, no validity bitmap).
All methods are static – ArrowExporter is a stateless utility class.
auto result = ArrowExporter::export_tensor(view, "prices", &arr, &sch);
// ... pass arr + sch to Arrow consumer ...
arr.release(&arr);
sch.release(&sch);
static expected< void > export_tensor(const TensorView &tensor, const std::string &name, ArrowArray *out_array, ArrowSchema *out_schema)
Export a TensorView as an ArrowArray + ArrowSchema pair (zero-copy).
Data payload for a single Arrow array.
void(* release)(ArrowArray *)
Release callback (null = already released)
Schema description for a single Arrow array/column.
void(* release)(ArrowSchema *)
Release callback (null = already released)
See also
ArrowImporter

Definition at line 307 of file arrow_bridge.hpp.

Member Function Documentation

◆ export_column()

static expected< void > signet::forge::ArrowExporter::export_column ( const void *  data,
int64_t  num_values,
PhysicalType  physical_type,
const std::string &  name,
ArrowArray out_array,
ArrowSchema out_schema 
)
inlinestatic

Export a 1D column of a primitive Parquet type as ArrowArray + ArrowSchema (zero-copy).

For numeric physical types (INT32, INT64, FLOAT, DOUBLE, BOOLEAN), this is zero-copy: buffers[1] points to the raw data pointer. The data pointer must remain valid for the entire lifetime of the ArrowArray.

Parameters
dataPointer to contiguous column data (must not be null).
num_valuesNumber of values in the column (must be > 0).
physical_typeParquet physical type of the column.
nameColumn name for the ArrowSchema.
out_arrayOutput ArrowArray (caller-allocated, populated on success).
out_schemaOutput ArrowSchema (caller-allocated, populated on success).
Returns
Success, or INTERNAL_ERROR for null/empty data, UNSUPPORTED_TYPE for variable-length physical types.
Note
The caller must call out_array->release(out_array) and out_schema->release(out_schema) when done.
See also
export_tensor

Definition at line 406 of file arrow_bridge.hpp.

◆ export_tensor()

static expected< void > signet::forge::ArrowExporter::export_tensor ( const TensorView tensor,
const std::string &  name,
ArrowArray out_array,
ArrowSchema out_schema 
)
inlinestatic

Export a TensorView as an ArrowArray + ArrowSchema pair (zero-copy).

The tensor is flattened to 1D for Arrow (Arrow arrays are 1D). For numeric types, this is zero-copy: buffers[1] points into the TensorView's memory. The TensorView must remain valid for the entire lifetime of the ArrowArray.

Parameters
tensorThe tensor to export (must be valid and contiguous).
nameThe column/field name for the ArrowSchema.
out_arrayOutput ArrowArray (caller-allocated, populated on success).
out_schemaOutput ArrowSchema (caller-allocated, populated on success).
Returns
Success, or INTERNAL_ERROR for invalid tensors, UNSUPPORTED_TYPE for non-contiguous or unmappable dtypes.
Note
The caller must call out_array->release(out_array) and out_schema->release(out_schema) when done.
See also
export_column

Definition at line 325 of file arrow_bridge.hpp.


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