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

Array builder that only adds elements if they already exist. More...

#include <arrow/builder.h>

Inheritance diagram for arrow::UniqueBuilder< T >:
arrow::ArrayBuilder

Public Types

using Scalar = typename internal::DictionaryScalar< T >::type
 

Public Member Functions

 UniqueBuilder (const std::shared_ptr< DataType > &type, MemoryPool *pool)
 
template<typename T1 = T>
 UniqueBuilder (typename std::enable_if< TypeTraits< T1 >::is_parameter_free, MemoryPool *>::type pool)
 
Status Append (const Scalar &value)
 Append a scalar value. More...
 
Status Append (const Scalar &value, int32_t *index)
 Append a scalar value and return the index in the array. More...
 
Status AppendArray (const Array &array)
 Append a whole dense array to the builder. More...
 
Status Init (int64_t elements) override
 Allocates initial capacity requirements for the builder. More...
 
Status Resize (int64_t capacity) override
 Resizes the null_bitmap array. More...
 
Status FinishInternal (std::shared_ptr< ArrayData > *out) override
 Return result of builder as an internal generic ArrayData object. 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 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
 
Status Finish (std::shared_ptr< Array > *out)
 Return result of builder as an Array object. More...
 
std::shared_ptr< DataTypetype () const
 

Protected Member Functions

Status DoubleTableSize ()
 
Scalar GetDictionaryValue (int64_t index)
 
int HashValue (const Scalar &value)
 
bool SlotDifferent (hash_slot_t slot, const Scalar &value)
 
Status AppendDictionary (const Scalar &value)
 
- Protected Member Functions inherited from arrow::ArrayBuilder
 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< PoolBufferhash_table_
 
int32_t * hash_slots_
 
int hash_table_size_
 Size of the table. Must be a power of 2. More...
 
int mod_bitmask_
 
TypeTraits< T >::BuilderType dict_builder_
 
int32_t byte_width_
 
- Protected Attributes inherited from arrow::ArrayBuilder
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

template<typename T>
class arrow::UniqueBuilder< T >

Array builder that only adds elements if they already exist.

Member Typedef Documentation

◆ Scalar

template<typename T>
using arrow::UniqueBuilder< T >::Scalar = typename internal::DictionaryScalar<T>::type

Constructor & Destructor Documentation

◆ UniqueBuilder() [1/2]

template<typename T>
arrow::UniqueBuilder< T >::UniqueBuilder ( const std::shared_ptr< DataType > &  type,
MemoryPool pool 
)

◆ UniqueBuilder() [2/2]

template<typename T>
template<typename T1 = T>
arrow::UniqueBuilder< T >::UniqueBuilder ( typename std::enable_if< TypeTraits< T1 >::is_parameter_free, MemoryPool *>::type  pool)
inlineexplicit

Member Function Documentation

◆ Append() [1/2]

template<typename T>
Status arrow::UniqueBuilder< T >::Append ( const Scalar value)

Append a scalar value.

◆ Append() [2/2]

template<typename T>
Status arrow::UniqueBuilder< T >::Append ( const Scalar value,
int32_t *  index 
)

Append a scalar value and return the index in the array.

◆ AppendArray()

template<typename T>
Status arrow::UniqueBuilder< T >::AppendArray ( const Array array)

Append a whole dense array to the builder.

◆ AppendDictionary()

template<typename T>
Status arrow::UniqueBuilder< T >::AppendDictionary ( const Scalar value)
protected

◆ DoubleTableSize()

template<typename T>
Status arrow::UniqueBuilder< T >::DoubleTableSize ( )
protected

◆ FinishInternal()

template<typename T>
Status arrow::UniqueBuilder< T >::FinishInternal ( std::shared_ptr< ArrayData > *  out)
overridevirtual

Return result of builder as an internal generic ArrayData object.

Resets builder

Parameters
[out]outthe finalized ArrayData object
Returns
Status

Implements arrow::ArrayBuilder.

◆ GetDictionaryValue()

template<typename T>
Scalar arrow::UniqueBuilder< T >::GetDictionaryValue ( int64_t  index)
protected

◆ HashValue()

template<typename T>
int arrow::UniqueBuilder< T >::HashValue ( const Scalar value)
protected

◆ Init()

template<typename T>
Status arrow::UniqueBuilder< T >::Init ( int64_t  capacity)
overridevirtual

Allocates initial capacity requirements for the builder.

In most cases subclasses should override and call their parent class's method as well.

Reimplemented from arrow::ArrayBuilder.

◆ Resize()

template<typename T>
Status arrow::UniqueBuilder< T >::Resize ( int64_t  new_bits)
overridevirtual

Resizes the null_bitmap array.

In most cases subclasses should override and call their parent class's method as well.

Reimplemented from arrow::ArrayBuilder.

◆ SlotDifferent()

template<typename T>
bool arrow::UniqueBuilder< T >::SlotDifferent ( hash_slot_t  slot,
const Scalar value 
)
protected

Member Data Documentation

◆ byte_width_

template<typename T>
int32_t arrow::UniqueBuilder< T >::byte_width_
protected

◆ dict_builder_

template<typename T>
TypeTraits<T>::BuilderType arrow::UniqueBuilder< T >::dict_builder_
protected

◆ hash_slots_

template<typename T>
int32_t* arrow::UniqueBuilder< T >::hash_slots_
protected

◆ hash_table_

template<typename T>
std::shared_ptr<PoolBuffer> arrow::UniqueBuilder< T >::hash_table_
protected

◆ hash_table_size_

template<typename T>
int arrow::UniqueBuilder< T >::hash_table_size_
protected

Size of the table. Must be a power of 2.

◆ mod_bitmask_

template<typename T>
int arrow::UniqueBuilder< T >::mod_bitmask_
protected

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