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

#include <arrow/builder.h>

Inheritance diagram for arrow::BooleanBuilder:
arrow::ArrayBuilder

Public Types

using value_type = bool
 

Public Member Functions

 BooleanBuilder (MemoryPool *pool ARROW_MEMORY_POOL_DEFAULT)
 
 BooleanBuilder (const std::shared_ptr< DataType > &type, MemoryPool *pool)
 
Status AppendNulls (const uint8_t *valid_bytes, int64_t length)
 Write nulls as uint8_t* (0 value indicates null) into pre-allocated memory. More...
 
Status AppendNull ()
 
Status Append (const bool val)
 Scalar append. More...
 
Status Append (const uint8_t val)
 
Status AppendValues (const uint8_t *values, int64_t length, const uint8_t *valid_bytes=NULLPTR)
 Append a sequence of elements in one shot. More...
 
Status AppendValues (const uint8_t *values, int64_t length, const std::vector< bool > &is_valid)
 Append a sequence of elements in one shot. More...
 
Status AppendValues (const std::vector< uint8_t > &values, const std::vector< bool > &is_valid)
 Append a sequence of elements in one shot. More...
 
Status AppendValues (const std::vector< uint8_t > &values)
 Append a sequence of elements in one shot. More...
 
Status AppendValues (const std::vector< bool > &values, const std::vector< bool > &is_valid)
 Append a sequence of elements in one shot. More...
 
Status AppendValues (const std::vector< bool > &values)
 Append a sequence of elements in one shot. More...
 
template<typename ValuesIter >
Status AppendValues (ValuesIter values_begin, ValuesIter values_end)
 Append a sequence of elements in one shot. More...
 
template<typename ValuesIter , typename ValidIter >
std::enable_if<!std::is_pointer< ValidIter >::value, Status >::type AppendValues (ValuesIter values_begin, ValuesIter values_end, ValidIter valid_begin)
 Append a sequence of elements in one shot, with a specified nullmap. More...
 
template<typename ValuesIter , typename ValidIter >
std::enable_if< std::is_pointer< ValidIter >::value, Status >::type AppendValues (ValuesIter values_begin, ValuesIter values_end, ValidIter valid_begin)
 Append a sequence of elements in one shot, with a specified nullmap. More...
 
Status FinishInternal (std::shared_ptr< ArrayData > *out) override
 Return result of builder as an internal generic ArrayData object. More...
 
void Reset () override
 Reset the builder. More...
 
Status Resize (int64_t capacity) override
 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 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...
 
- 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...
 
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::shared_ptr< ResizableBufferdata_
 
uint8_t * raw_data_
 
- 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)
 

Member Typedef Documentation

◆ value_type

Constructor & Destructor Documentation

◆ BooleanBuilder() [1/2]

arrow::BooleanBuilder::BooleanBuilder ( MemoryPool *pool  ARROW_MEMORY_POOL_DEFAULT)
explicit

◆ BooleanBuilder() [2/2]

arrow::BooleanBuilder::BooleanBuilder ( const std::shared_ptr< DataType > &  type,
MemoryPool pool 
)
explicit

Member Function Documentation

◆ Advance()

Status arrow::ArrayBuilder::Advance

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.

◆ Append() [1/2]

Status arrow::BooleanBuilder::Append ( const bool  val)
inline

Scalar append.

◆ Append() [2/2]

Status arrow::BooleanBuilder::Append ( const uint8_t  val)
inline

◆ AppendNull()

Status arrow::BooleanBuilder::AppendNull ( )
inline

◆ AppendNulls()

Status arrow::BooleanBuilder::AppendNulls ( const uint8_t *  valid_bytes,
int64_t  length 
)
inline

Write nulls as uint8_t* (0 value indicates null) into pre-allocated memory.

◆ AppendValues() [1/9]

Status arrow::BooleanBuilder::AppendValues ( const uint8_t *  values,
int64_t  length,
const uint8_t *  valid_bytes = NULLPTR 
)

Append a sequence of elements in one shot.

Parameters
[in]valuesa contiguous array of bytes (non-zero is 1)
[in]lengththe number of values to append
[in]valid_bytesan optional sequence of bytes where non-zero indicates a valid (non-null) value
Returns
Status

◆ AppendValues() [2/9]

Status arrow::BooleanBuilder::AppendValues ( const uint8_t *  values,
int64_t  length,
const std::vector< bool > &  is_valid 
)

Append a sequence of elements in one shot.

Parameters
[in]valuesa contiguous C array of values
[in]lengththe number of values to append
[in]is_validan std::vector<bool> indicating valid (1) or null (0). Equal in length to values
Returns
Status

◆ AppendValues() [3/9]

Status arrow::BooleanBuilder::AppendValues ( const std::vector< uint8_t > &  values,
const std::vector< bool > &  is_valid 
)

Append a sequence of elements in one shot.

Parameters
[in]valuesa std::vector of bytes
[in]is_validan std::vector<bool> indicating valid (1) or null (0). Equal in length to values
Returns
Status

◆ AppendValues() [4/9]

Status arrow::BooleanBuilder::AppendValues ( const std::vector< uint8_t > &  values)

Append a sequence of elements in one shot.

Parameters
[in]valuesa std::vector of bytes
Returns
Status

◆ AppendValues() [5/9]

Status arrow::BooleanBuilder::AppendValues ( const std::vector< bool > &  values,
const std::vector< bool > &  is_valid 
)

Append a sequence of elements in one shot.

Parameters
[in]valuesan std::vector<bool> indicating true (1) or false
[in]is_validan std::vector<bool> indicating valid (1) or null (0). Equal in length to values
Returns
Status

◆ AppendValues() [6/9]

Status arrow::BooleanBuilder::AppendValues ( const std::vector< bool > &  values)

Append a sequence of elements in one shot.

Parameters
[in]valuesan std::vector<bool> indicating true (1) or false
Returns
Status

◆ AppendValues() [7/9]

template<typename ValuesIter >
Status arrow::BooleanBuilder::AppendValues ( ValuesIter  values_begin,
ValuesIter  values_end 
)
inline

Append a sequence of elements in one shot.

Parameters
[in]values_beginInputIterator to the beginning of the values
[in]values_endInputIterator pointing to the end of the values or null(0) values
Returns
Status

◆ AppendValues() [8/9]

template<typename ValuesIter , typename ValidIter >
std::enable_if<!std::is_pointer<ValidIter>::value, Status>::type arrow::BooleanBuilder::AppendValues ( ValuesIter  values_begin,
ValuesIter  values_end,
ValidIter  valid_begin 
)
inline

Append a sequence of elements in one shot, with a specified nullmap.

Parameters
[in]values_beginInputIterator to the beginning of the values
[in]values_endInputIterator pointing to the end of the values
[in]valid_beginInputIterator with elements indication valid(1) or null(0) values
Returns
Status

◆ AppendValues() [9/9]

template<typename ValuesIter , typename ValidIter >
std::enable_if<std::is_pointer<ValidIter>::value, Status>::type arrow::BooleanBuilder::AppendValues ( ValuesIter  values_begin,
ValuesIter  values_end,
ValidIter  valid_begin 
)
inline

Append a sequence of elements in one shot, with a specified nullmap.

Parameters
[in]values_beginInputIterator to the beginning of the values
[in]values_endInputIterator pointing to the end of the values
[in]valid_beginuint8_t* indication valid(1) or null(0) values. nullptr indicates all values are valid.
Returns
Status

◆ FinishInternal()

Status arrow::BooleanBuilder::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.

◆ Reset()

void arrow::BooleanBuilder::Reset ( )
overridevirtual

Reset the builder.

Reimplemented from arrow::ArrayBuilder.

◆ Resize()

Status arrow::BooleanBuilder::Resize ( int64_t  capacity)
overridevirtual

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.

Does not account for reallocations that may be due to variable size data, like binary values. To make space for incremental appends, use Reserve instead.

Parameters
[in]capacitythe minimum number of additional array values
Returns
Status

Reimplemented from arrow::ArrayBuilder.

Member Data Documentation

◆ data_

std::shared_ptr<ResizableBuffer> arrow::BooleanBuilder::data_
protected

◆ raw_data_

uint8_t* arrow::BooleanBuilder::raw_data_
protected

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