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

Append, Resize and Reserve methods are acting on StructBuilder. More...

#include <arrow/builder.h>

Inheritance diagram for arrow::StructBuilder:
arrow::ArrayBuilder

Public Member Functions

 StructBuilder (const std::shared_ptr< DataType > &type, MemoryPool *pool, std::vector< std::shared_ptr< ArrayBuilder >> &&field_builders)
 
Status FinishInternal (std::shared_ptr< ArrayData > *out) override
 Return result of builder as an internal generic ArrayData object. More...
 
Status AppendValues (int64_t length, const uint8_t *valid_bytes)
 Null bitmap is of equal length to every child field, and any zero byte will be considered as a null for that field, but users must using app- end methods or advance methods of the child builders' independently to insert data. More...
 
Status Append (bool is_valid=true)
 Append an element to the Struct. More...
 
Status AppendNull ()
 
void Reset () override
 Reset the builder. More...
 
ArrayBuilderfield_builder (int i) const
 
int num_fields () const
 
- Public Member Functions inherited from arrow::ArrayBuilder
 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 Resize (int64_t capacity)
 Ensure that enough memory has been allocated to fit the indicated number of total elements in the builder, including any that have already been appended. More...
 
Status Reserve (int64_t additional_capacity)
 Ensure that there is enough space allocated to add the indicated number of elements without any further calls to Resize. 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...
 
Status Finish (std::shared_ptr< Array > *out)
 Return result of builder as an Array object. More...
 
std::shared_ptr< DataTypetype () const
 
void UnsafeAppendToBitmap (bool is_valid)
 
template<typename IterType >
void UnsafeAppendToBitmap (const IterType &begin, const IterType &end)
 

Protected Attributes

std::vector< std::shared_ptr< ArrayBuilder > > field_builders_
 
- Protected Attributes inherited from arrow::ArrayBuilder
std::shared_ptr< DataTypetype_
 
MemoryPoolpool_
 
std::shared_ptr< ResizableBuffernull_bitmap_
 
int64_t null_count_
 
uint8_t * null_bitmap_data_
 
int64_t length_
 
int64_t capacity_
 
std::vector< std::unique_ptr< ArrayBuilder > > children_
 

Additional Inherited Members

- Protected Member Functions inherited from arrow::ArrayBuilder
 ArrayBuilder ()
 
void UnsafeAppendToBitmap (const uint8_t *valid_bytes, int64_t length)
 
void UnsafeAppendToBitmap (const std::vector< bool > &is_valid)
 
void UnsafeSetNotNull (int64_t length)
 

Detailed Description

Append, Resize and Reserve methods are acting on StructBuilder.

Please make sure all these methods of all child-builders' are consistently called to maintain data-structure consistency.

Constructor & Destructor Documentation

◆ StructBuilder()

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

Member Function Documentation

◆ Append()

Status arrow::StructBuilder::Append ( bool  is_valid = true)
inline

Append an element to the Struct.

All child-builders' Append method must be called independently to maintain data-structure consistency.

◆ AppendNull()

Status arrow::StructBuilder::AppendNull ( )
inline

◆ AppendValues()

Status arrow::StructBuilder::AppendValues ( int64_t  length,
const uint8_t *  valid_bytes 
)
inline

Null bitmap is of equal length to every child field, and any zero byte will be considered as a null for that field, but users must using app- end methods or advance methods of the child builders' independently to insert data.

◆ field_builder()

ArrayBuilder* arrow::StructBuilder::field_builder ( int  i) const
inline

◆ FinishInternal()

Status arrow::StructBuilder::FinishInternal ( std::shared_ptr< ArrayData > *  out)
overridevirtual

Return result of builder as an internal generic ArrayData object.

Resets builder except for dictionary builder

Parameters
[out]outthe finalized ArrayData object
Returns
Status

Implements arrow::ArrayBuilder.

◆ num_fields()

int arrow::StructBuilder::num_fields ( ) const
inline

◆ Reset()

void arrow::StructBuilder::Reset ( )
overridevirtual

Reset the builder.

Reimplemented from arrow::ArrayBuilder.

Member Data Documentation

◆ field_builders_

std::vector<std::shared_ptr<ArrayBuilder> > arrow::StructBuilder::field_builders_
protected

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