ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches

The sequences of ADS as the columns of Apache Arrow, by its C Data Interface (https://arrow.apache.org/docs/format/CDataInterface.html). More...

Files

file  ADS/interop/arrow/Arrow.h
 The sequences of ADS as the columns of Apache Arrow, by its C Data Interface (https://arrow.apache.org/docs/format/CDataInterface.html): two structures of C, ArrowSchema (the type of a column) and ArrowArray (its buffers), each with a callback release that frees what its producer keeps alive, through which pyarrow, Polars, DuckDB, pandas and nanoarrow hand columns to one another within a process with no copy.

Concepts

concept  ADS::ArrowNumber
 the numbers that are the values of a column of Arrow: the integers of 8, 16, 32 and 64 bits, float and double
concept  ADS::ArrowExportable
 what exportArrow() exports: a BitVector, a PackedArray or a sized sequence of numbers

Classes

class  ADS::ArrowColumn< T >
 a column of Arrow of numbers of type \( T \), taken without copy: its values stay in the memory of its producer, which this object releases when destroyed More...
struct  ArrowSchema
 the type of a column of Arrow More...
struct  ArrowArray
 the buffers of a column of Arrow More...

Functions

template<ArrowNumber T>
constexpr const char * ADS::arrowFormat (void)
 the format of Arrow of the numbers of type \( T \)
template<class X>
requires ArrowExportable< std::remove_const_t< X > >
void ADS::exportArrow (std::shared_ptr< X > x, ArrowArray *a, ArrowSchema *s, std::string_view name="")
 the structure \( *x \) as a column of Arrow of no nulls, named \( \mathit{name} \), in \( *a \) and \( *s \), which its consumer releases; the values are those of \( *x \), which the array keeps alive (copied where the layouts differ, see above)
template<class X>
requires ArrowExportable< X >
void ADS::exportArrow (X x, ArrowArray *a, ArrowSchema *s, std::string_view name="")
 the structure \( x \) as a column of Arrow of no nulls, named \( \mathit{name} \), in \( *a \) and \( *s \): \( x \) is moved into the array, which keeps it alive until its consumer releases it
BitVector ADS::toBitVector (const ArrowArray &a, const ArrowSchema &s)
 the column of booleans \( a \) of type \( s \) copied into a BitVector; \( a \) and \( s \) are only read
template<unsigned B, bool S = false>
PackedArray< B, S > ADS::toPackedArray (const ArrowArray &a, const ArrowSchema &s)
 the column \( a \) of type \( s \) copied into a PackedArray< B , S >: a column of booleans if \( B = 1 \), or of integers of any width, each value clamped to \( 2^B - 1 \) if \( S \); \( a \) and \( s \) are only read
template<ArrowNumber T>
std::vector< T > ADS::toVector (const ArrowArray &a, const ArrowSchema &s)
 the column \( a \) of numbers of type \( T \), of type \( s \), copied into a std::vector; \( a \) and \( s \) are only read

Detailed description

The sequences of ADS as the columns of Apache Arrow, by its C Data Interface (https://arrow.apache.org/docs/format/CDataInterface.html).

Function documentation

◆ arrowFormat()

template<ArrowNumber T>
const char * ADS::arrowFormat ( void )
nodiscardconstexpr

the format of Arrow of the numbers of type \( T \)

◆ exportArrow() [1/2]

template<class X>
requires ArrowExportable< std::remove_const_t< X > >
void ADS::exportArrow ( std::shared_ptr< X > x,
ArrowArray * a,
ArrowSchema * s,
std::string_view name = "" )

the structure \( *x \) as a column of Arrow of no nulls, named \( \mathit{name} \), in \( *a \) and \( *s \), which its consumer releases; the values are those of \( *x \), which the array keeps alive (copied where the layouts differ, see above)

Precondition
\( a \) and \( s \) not null, \( *x \) not changed until the array is released

◆ exportArrow() [2/2]

template<class X>
requires ArrowExportable< X >
void ADS::exportArrow ( X x,
ArrowArray * a,
ArrowSchema * s,
std::string_view name = "" )

the structure \( x \) as a column of Arrow of no nulls, named \( \mathit{name} \), in \( *a \) and \( *s \): \( x \) is moved into the array, which keeps it alive until its consumer releases it

◆ toBitVector()

BitVector ADS::toBitVector ( const ArrowArray & a,
const ArrowSchema & s )
inline

the column of booleans \( a \) of type \( s \) copied into a BitVector; \( a \) and \( s \) are only read

Exceptions
std::invalid_argumentif the column is released, has nulls or children, or is not of booleans

◆ toPackedArray()

template<unsigned B, bool S = false>
PackedArray< B, S > ADS::toPackedArray ( const ArrowArray & a,
const ArrowSchema & s )
nodiscard

the column \( a \) of type \( s \) copied into a PackedArray< B , S >: a column of booleans if \( B = 1 \), or of integers of any width, each value clamped to \( 2^B - 1 \) if \( S \); \( a \) and \( s \) are only read

Exceptions
std::invalid_argumentif the column is released, has nulls or children, is not of integers (or booleans), or has a value negative or, unless \( S \), of more than \( B \) bits

◆ toVector()

template<ArrowNumber T>
std::vector< T > ADS::toVector ( const ArrowArray & a,
const ArrowSchema & s )
nodiscard

the column \( a \) of numbers of type \( T \), of type \( s \), copied into a std::vector; \( a \) and \( s \) are only read

Exceptions
std::invalid_argumentif the column is released, has nulls or children, or is not of the format of \( T \)