Apache Arrow (C++)
A columnar in-memory analytics layer designed to accelerate big data.
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
arrow::ArrayBuilder Class Referenceabstract

Base class for all data array builders. More...

#include <arrow/builder.h>

Inheritance diagram for arrow::ArrayBuilder:
arrow::BinaryBuilder arrow::BooleanBuilder arrow::DictionaryBuilder< T > arrow::DictionaryBuilder< NullType > arrow::FixedSizeBinaryBuilder arrow::ListBuilder arrow::NullBuilder arrow::PrimitiveBuilder< Type > arrow::StructBuilder arrow::UniqueBuilder< T > arrow::DictionaryBuilder< BinaryType > arrow::DictionaryBuilder< StringType > arrow::PrimitiveBuilder< T > arrow::UniqueBuilder< BinaryType > arrow::UniqueBuilder< StringType >

Public Member Functions

 ArrayBuilder (const std::shared_ptr< DataType > &type, MemoryPool *pool)
 
virtual ~ArrayBuilder ()=default
 
ArrayBuilderchild (int i)
 For nested types. More...
 
int num_children () const
 
int64_t length () const
 
int64_t null_count () const
 
int64_t capacity () const
 
Status AppendToBitmap (bool is_valid)
 Append to null bitmap. More...
 
Status AppendToBitmap (const uint8_t *valid_bytes, int64_t length)
 Vector append. More...
 
Status SetNotNull (int64_t length)
 Set the next length bits to not null (i.e. valid). More...
 
virtual Status Init (int64_t capacity)
 Allocates initial capacity requirements for the builder. More...
 
virtual Status Resize (int64_t new_bits)
 Resizes the null_bitmap array. More...
 
Status Reserve (int64_t elements)
 Ensures there is enough space for adding the number of elements by checking capacity and calling Resize if necessary. More...
 
Status Advance (int64_t elements)
 For cases where raw data was memcpy'd into the internal buffers, allows us to advance the length of the builder. More...
 
std::shared_ptr< PoolBuffernull_bitmap () const
 
virtual Status FinishInternal (std::shared_ptr< ArrayData > *out)=0
 Return result of builder as an internal generic ArrayData object. More...
 
Status Finish (std::shared_ptr< Array > *out)
 Return result of builder as an Array object. More...
 
std::shared_ptr< DataTypetype () const
 

Protected Member Functions

 ArrayBuilder ()
 
void Reset ()
 
void UnsafeAppendToBitmap (bool is_valid)
 
void UnsafeAppendToBitmap (const uint8_t *valid_bytes, int64_t length)
 
void UnsafeAppendToBitmap (const std::vector< bool > &is_valid)
 
void UnsafeSetNotNull (int64_t length)
 

Protected Attributes

std::shared_ptr< DataTypetype_
 
MemoryPoolpool_
 
std::shared_ptr< PoolBuffernull_bitmap_
 
int64_t null_count_
 
uint8_t * null_bitmap_data_
 
int64_t length_
 
int64_t capacity_
 
std::vector< std::unique_ptr< ArrayBuilder > > children_
 

Detailed Description

Base class for all data array builders.

This class provides a facilities for incrementally building the null bitmap (see Append methods) and as a side effect the current number of slots and the null count.

Constructor & Destructor Documentation

◆ ArrayBuilder() [1/2]

arrow::ArrayBuilder::ArrayBuilder ( const std::shared_ptr< DataType > &  type,
MemoryPool pool 
)
inlineexplicit

◆ ~ArrayBuilder()

virtual arrow::ArrayBuilder::~ArrayBuilder ( )
virtualdefault

◆ ArrayBuilder() [2/2]

arrow::ArrayBuilder::ArrayBuilder ( )
inlineprotected

Member Function Documentation

◆ Advance()

Status arrow::ArrayBuilder::Advance ( int64_t  elements)

For cases where raw data was memcpy'd into the internal buffers, allows us to advance the length of the builder.

It is your responsibility to use this function responsibly.

◆ AppendToBitmap() [1/2]

Status arrow::ArrayBuilder::AppendToBitmap ( bool  is_valid)

Append to null bitmap.

◆ AppendToBitmap() [2/2]

Status arrow::ArrayBuilder::AppendToBitmap ( const uint8_t *  valid_bytes,
int64_t  length 
)

Vector append.

Treat each zero byte as a null. If valid_bytes is null assume all of length bits are valid.

◆ capacity()

int64_t arrow::ArrayBuilder::capacity ( ) const
inline

◆ child()

ArrayBuilder* arrow::ArrayBuilder::child ( int  i)
inline

For nested types.

Since the objects are owned by this class instance, we skip shared pointers and just return a raw pointer

◆ Finish()

Status arrow::ArrayBuilder::Finish ( std::shared_ptr< Array > *  out)

Return result of builder as an Array object.

Resets builder

Parameters
[out]outthe finalized Array object
Returns
Status

◆ FinishInternal()

virtual Status arrow::ArrayBuilder::FinishInternal ( std::shared_ptr< ArrayData > *  out)
pure virtual

◆ Init()

virtual Status arrow::ArrayBuilder::Init ( int64_t  capacity)
virtual

◆ length()

int64_t arrow::ArrayBuilder::length ( ) const
inline

◆ null_bitmap()

std::shared_ptr<PoolBuffer> arrow::ArrayBuilder::null_bitmap ( ) const
inline

◆ null_count()

int64_t arrow::ArrayBuilder::null_count ( ) const
inline

◆ num_children()

int arrow::ArrayBuilder::num_children ( ) const
inline

◆ Reserve()

Status arrow::ArrayBuilder::Reserve ( int64_t  elements)

Ensures there is enough space for adding the number of elements by checking capacity and calling Resize if necessary.

◆ Reset()

void arrow::ArrayBuilder::Reset ( )
protected

◆ Resize()

virtual Status arrow::ArrayBuilder::Resize ( int64_t  new_bits)
virtual

◆ SetNotNull()

Status arrow::ArrayBuilder::SetNotNull ( int64_t  length)

Set the next length bits to not null (i.e. valid).

◆ type()

std::shared_ptr<DataType> arrow::ArrayBuilder::type ( ) const
inline

◆ UnsafeAppendToBitmap() [1/3]

void arrow::ArrayBuilder::UnsafeAppendToBitmap ( bool  is_valid)
inlineprotected

◆ UnsafeAppendToBitmap() [2/3]

void arrow::ArrayBuilder::UnsafeAppendToBitmap ( const uint8_t *  valid_bytes,
int64_t  length 
)
protected

◆ UnsafeAppendToBitmap() [3/3]

void arrow::ArrayBuilder::UnsafeAppendToBitmap ( const std::vector< bool > &  is_valid)
protected

◆ UnsafeSetNotNull()

void arrow::ArrayBuilder::UnsafeSetNotNull ( int64_t  length)
protected

Member Data Documentation

◆ capacity_

int64_t arrow::ArrayBuilder::capacity_
protected

◆ children_

std::vector<std::unique_ptr<ArrayBuilder> > arrow::ArrayBuilder::children_
protected

◆ length_

int64_t arrow::ArrayBuilder::length_
protected

◆ null_bitmap_

std::shared_ptr<PoolBuffer> arrow::ArrayBuilder::null_bitmap_
protected

◆ null_bitmap_data_

uint8_t* arrow::ArrayBuilder::null_bitmap_data_
protected

◆ null_count_

int64_t arrow::ArrayBuilder::null_count_
protected

◆ pool_

MemoryPool* arrow::ArrayBuilder::pool_
protected

◆ type_

std::shared_ptr<DataType> arrow::ArrayBuilder::type_
protected

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