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

Imports Arrow C Data Interface arrays into Signet TensorView or OwnedTensor. More...

#include <arrow_bridge.hpp>

Static Public Member Functions

static expected< TensorViewimport_array (const ArrowArray *array, const ArrowSchema *schema)
 Import an ArrowArray as a TensorView (zero-copy).
 
static expected< OwnedTensorimport_array_copy (const ArrowArray *array, const ArrowSchema *schema)
 Import an ArrowArray as an OwnedTensor (deep copy).
 

Detailed Description

Imports Arrow C Data Interface arrays into Signet TensorView or OwnedTensor.

Supports two import modes:

Note
Only primitive numeric types with single-character Arrow format codes are supported. Nullable arrays (null_count != 0) are rejected.
A defense-in-depth cap of 1 billion elements is enforced to prevent OOB reads from crafted metadata (Arrow C Data Interface does not carry buffer sizes).
All methods are static – ArrowImporter is a stateless utility class.
See also
ArrowExporter

Definition at line 482 of file arrow_bridge.hpp.

Member Function Documentation

◆ import_array()

static expected< TensorView > signet::forge::ArrowImporter::import_array ( const ArrowArray array,
const ArrowSchema schema 
)
inlinestatic

Import an ArrowArray as a TensorView (zero-copy).

The ArrowArray must contain a single-buffer primitive numeric type (matching a single-character format string). The returned TensorView wraps buffers[1] directly – the ArrowArray must remain alive and unreleased for the entire lifetime of the TensorView.

The tensor is shaped as 1D: [length]. The ArrowArray.offset field is respected (data pointer is advanced by offset * element_size).

Parameters
arrayPointer to a valid, unreleased ArrowArray (must not be null).
schemaPointer to a valid ArrowSchema describing the array (must not be null).
Returns
A 1D TensorView wrapping the Arrow data, or an error.

Validation checks performed:

  • Null/released array or schema
  • null_count != 0 (nullable arrays rejected)
  • Unsupported or multi-character format strings
  • Zero/negative length, negative offset
  • Length exceeding 1 billion element import cap
  • Offset + length overflow
  • Missing data buffer (buffers[1])
See also
import_array_copy

Definition at line 508 of file arrow_bridge.hpp.

◆ import_array_copy()

static expected< OwnedTensor > signet::forge::ArrowImporter::import_array_copy ( const ArrowArray array,
const ArrowSchema schema 
)
inlinestatic

Import an ArrowArray as an OwnedTensor (deep copy).

Copies the data from the ArrowArray into a new heap allocation. After this call returns, the ArrowArray can be released independently – the OwnedTensor owns its data.

Internally delegates to import_array() for validation, then copies the TensorView's data into the OwnedTensor.

Parameters
arrayPointer to a valid, unreleased ArrowArray (must not be null).
schemaPointer to a valid ArrowSchema describing the array (must not be null).
Returns
An OwnedTensor with a deep copy of the Arrow data, or any error that import_array() would return.
See also
import_array

Definition at line 625 of file arrow_bridge.hpp.


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