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

Immutable data array with some logical type and some length. More...

#include <array.h>

Inheritance diagram for arrow::Array:
arrow::BinaryArray arrow::DictionaryArray arrow::ListArray arrow::NullArray arrow::PrimitiveArray arrow::StructArray arrow::UnionArray arrow::StringArray arrow::BooleanArray arrow::FixedSizeBinaryArray arrow::NumericArray< TYPE > arrow::DecimalArray

Public Member Functions

 Array (const std::shared_ptr< DataType > &type, int64_t length, const std::shared_ptr< Buffer > &null_bitmap=nullptr, int64_t null_count=0, int64_t offset=0)
 
virtual ~Array ()=default
 
bool IsNull (int64_t i) const
 Determine if a slot is null. For inner loops. Does not boundscheck. More...
 
int64_t length () const
 Size in the number of elements this array contains. More...
 
int64_t offset () const
 A relative position into another array's data, to enable zero-copy slicing. More...
 
int64_t null_count () const
 The number of null entries in the array. More...
 
std::shared_ptr< DataTypetype () const
 
Type::type type_id () const
 
std::shared_ptr< Buffernull_bitmap () const
 Buffer for the null bitmap. More...
 
const uint8_t * null_bitmap_data () const
 Raw pointer to the null bitmap. More...
 
bool Equals (const Array &arr) const
 
bool Equals (const std::shared_ptr< Array > &arr) const
 
bool ApproxEquals (const std::shared_ptr< Array > &arr) const
 
bool ApproxEquals (const Array &arr) const
 
bool RangeEquals (int64_t start_idx, int64_t end_idx, int64_t other_start_idx, const std::shared_ptr< Array > &other) const
 Compare if the range of slots specified are equal for the given array and this array. More...
 
bool RangeEquals (const Array &other, int64_t start_idx, int64_t end_idx, int64_t other_start_idx) const
 
Status Accept (ArrayVisitor *visitor) const
 
virtual std::shared_ptr< ArraySlice (int64_t offset, int64_t length) const =0
 Construct a zero-copy slice of the array with the indicated offset and length. More...
 
std::shared_ptr< ArraySlice (int64_t offset) const
 Slice from offset until end of the array. More...
 

Protected Attributes

std::shared_ptr< DataTypetype_
 
int64_t length_
 
int64_t offset_
 
int64_t null_count_
 
std::shared_ptr< Buffernull_bitmap_
 
const uint8_t * null_bitmap_data_
 

Detailed Description

Immutable data array with some logical type and some length.

Any memory is owned by the respective Buffer instance (or its parents).

The base class is only required to have a null bitmap buffer if the null count is greater than 0

If known, the null count can be provided in the base Array constructor. If the null count is not known, pass -1 to indicate that the null count is to be computed on the first call to null_count()

Constructor & Destructor Documentation

◆ Array()

arrow::Array::Array ( const std::shared_ptr< DataType > &  type,
int64_t  length,
const std::shared_ptr< Buffer > &  null_bitmap = nullptr,
int64_t  null_count = 0,
int64_t  offset = 0 
)

◆ ~Array()

virtual arrow::Array::~Array ( )
virtualdefault

Member Function Documentation

◆ Accept()

Status arrow::Array::Accept ( ArrayVisitor visitor) const

◆ ApproxEquals() [1/2]

bool arrow::Array::ApproxEquals ( const std::shared_ptr< Array > &  arr) const

◆ ApproxEquals() [2/2]

bool arrow::Array::ApproxEquals ( const Array arr) const

◆ Equals() [1/2]

bool arrow::Array::Equals ( const Array arr) const

◆ Equals() [2/2]

bool arrow::Array::Equals ( const std::shared_ptr< Array > &  arr) const

◆ IsNull()

bool arrow::Array::IsNull ( int64_t  i) const
inline

Determine if a slot is null. For inner loops. Does not boundscheck.

◆ length()

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

Size in the number of elements this array contains.

◆ null_bitmap()

std::shared_ptr<Buffer> arrow::Array::null_bitmap ( ) const
inline

Buffer for the null bitmap.

Note that for null_count == 0, this can be a nullptr. This buffer does not account for any slice offset

◆ null_bitmap_data()

const uint8_t* arrow::Array::null_bitmap_data ( ) const
inline

Raw pointer to the null bitmap.

Note that for null_count == 0, this can be a nullptr. This buffer does not account for any slice offset

◆ null_count()

int64_t arrow::Array::null_count ( ) const

The number of null entries in the array.

If the null count was not known at time of construction (and set to a negative value), then the null count will be computed and cached on the first invocation of this function

◆ offset()

int64_t arrow::Array::offset ( ) const
inline

A relative position into another array's data, to enable zero-copy slicing.

This value defaults to zero

◆ RangeEquals() [1/2]

bool arrow::Array::RangeEquals ( int64_t  start_idx,
int64_t  end_idx,
int64_t  other_start_idx,
const std::shared_ptr< Array > &  other 
) const

Compare if the range of slots specified are equal for the given array and this array.

end_idx exclusive. This methods does not bounds check.

◆ RangeEquals() [2/2]

bool arrow::Array::RangeEquals ( const Array other,
int64_t  start_idx,
int64_t  end_idx,
int64_t  other_start_idx 
) const

◆ Slice() [1/2]

virtual std::shared_ptr<Array> arrow::Array::Slice ( int64_t  offset,
int64_t  length 
) const
pure virtual

Construct a zero-copy slice of the array with the indicated offset and length.

Parameters
[in]offsetthe position of the first element in the constructed slice
[in]lengththe length of the slice. If there are not enough elements in the array, the length will be adjusted accordingly
Returns
a new object wrapped in std::shared_ptr<Array>

Implemented in arrow::DictionaryArray, arrow::UnionArray, arrow::StructArray, arrow::DecimalArray, arrow::FixedSizeBinaryArray, arrow::StringArray, arrow::BinaryArray, arrow::ListArray, arrow::BooleanArray, arrow::NumericArray< TYPE >, and arrow::NullArray.

◆ Slice() [2/2]

std::shared_ptr< Array > arrow::Array::Slice ( int64_t  offset) const

Slice from offset until end of the array.

◆ type()

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

◆ type_id()

Type::type arrow::Array::type_id ( ) const
inline

Member Data Documentation

◆ length_

int64_t arrow::Array::length_
protected

◆ null_bitmap_

std::shared_ptr<Buffer> arrow::Array::null_bitmap_
protected

◆ null_bitmap_data_

const uint8_t* arrow::Array::null_bitmap_data_
protected

◆ null_count_

int64_t arrow::Array::null_count_
mutableprotected

◆ offset_

int64_t arrow::Array::offset_
protected

◆ type_

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

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