sparrow ..
|
Dense union array implementation with offset buffer. More...
#include <union_array.hpp>
Public Types | |
using | base_type = union_array_crtp_base<dense_union_array> |
using | offset_buffer_type = u8_buffer<std::uint32_t> |
using | type_id_buffer_type = typename base_type::type_id_buffer_type |
![]() | |
using | self_type |
using | derived_type |
using | inner_value_type |
using | value_type |
using | const_reference |
using | functor_type |
using | const_functor_type |
using | iterator |
using | const_iterator |
using | const_reverse_iterator |
using | size_type |
using | type_id_buffer_type |
Public Member Functions | |
template<class... Args> requires (mpl::excludes_copy_and_move_ctor_v<dense_union_array, Args...>) | |
dense_union_array (Args &&... args) | |
Generic constructor for creating dense union arrays. | |
SPARROW_API | dense_union_array (arrow_proxy proxy) |
Constructs dense union array from Arrow proxy. | |
SPARROW_API | dense_union_array (const dense_union_array &rhs) |
Copy constructor. | |
SPARROW_API dense_union_array & | operator= (const dense_union_array &rhs) |
Copy assignment operator. | |
dense_union_array (dense_union_array &&rhs)=default | |
dense_union_array & | operator= (dense_union_array &&rhs)=default |
template<input_metadata_container METADATA_RANGE> | |
auto | create_proxy_impl (std::vector< array > &&children, type_id_buffer_type &&element_type, offset_buffer_type &&offsets, std::string &&format, std::optional< std::string_view > name, std::optional< METADATA_RANGE > metadata) -> arrow_proxy |
![]() | |
constexpr std::optional< std::string_view > | name () const |
Gets the optional name of the union array. | |
SPARROW_CONSTEXPR_CLANG std::optional< key_value_view > | metadata () const |
Gets the metadata associated with the union array. | |
SPARROW_CONSTEXPR_CLANG value_type | at (size_type i) const |
Gets element at specified position with bounds checking. | |
SPARROW_CONSTEXPR_CLANG value_type | operator[] (size_type i) const |
Gets element at specified position without bounds checking. | |
SPARROW_CONSTEXPR_CLANG value_type | operator[] (size_type i) |
Gets mutable element at specified position. | |
SPARROW_CONSTEXPR_CLANG value_type | front () const |
Gets reference to the first element. | |
SPARROW_CONSTEXPR_CLANG value_type | back () const |
Gets reference to the last element. | |
constexpr bool | empty () const |
Checks if the union array is empty. | |
constexpr size_type | size () const |
Gets the number of elements in the union array. | |
constexpr iterator | begin () |
Gets iterator to the beginning of the array. | |
constexpr iterator | end () |
Gets iterator to the end of the array. | |
constexpr const_iterator | begin () const |
Gets const iterator to the beginning of the array. | |
constexpr const_iterator | end () const |
Gets const iterator to the end of the array. | |
constexpr const_iterator | cbegin () const |
Gets const iterator to the beginning of the array. | |
constexpr const_iterator | cend () const |
Gets const iterator to the end of the array. | |
constexpr const_reverse_iterator | rbegin () const |
Gets reverse iterator to the beginning of reversed array. | |
constexpr const_reverse_iterator | rend () const |
Gets reverse iterator to the end of reversed array. | |
constexpr const_reverse_iterator | crbegin () const |
Gets const reverse iterator to the beginning of reversed array. | |
constexpr const_reverse_iterator | crend () const |
Gets const reverse iterator to the end of reversed array. | |
constexpr void | zero_null_values (const inner_value_type &value) |
Sets all null values to the specified value. | |
constexpr auto | type_id_map_from_child_to_type_id (const std::optional< R > &child_index_to_type_id) -> type_id_map |
constexpr std::optional< std::string_view > | name () const |
Gets the optional name of the union array. | |
SPARROW_CONSTEXPR_CLANG std::optional< key_value_view > | metadata () const |
Gets the metadata associated with the union array. | |
SPARROW_CONSTEXPR_CLANG value_type | at (size_type i) const |
Gets element at specified position with bounds checking. | |
SPARROW_CONSTEXPR_CLANG value_type | operator[] (size_type i) const |
Gets element at specified position without bounds checking. | |
SPARROW_CONSTEXPR_CLANG value_type | operator[] (size_type i) |
Gets mutable element at specified position. | |
SPARROW_CONSTEXPR_CLANG value_type | front () const |
Gets reference to the first element. | |
SPARROW_CONSTEXPR_CLANG value_type | back () const |
Gets reference to the last element. | |
constexpr bool | empty () const |
Checks if the union array is empty. | |
constexpr size_type | size () const |
Gets the number of elements in the union array. | |
constexpr iterator | begin () |
Gets iterator to the beginning of the array. | |
constexpr const_iterator | begin () const |
Gets const iterator to the beginning of the array. | |
constexpr iterator | end () |
Gets iterator to the end of the array. | |
constexpr const_iterator | end () const |
Gets const iterator to the end of the array. | |
constexpr const_iterator | cbegin () const |
Gets const iterator to the beginning of the array. | |
constexpr const_iterator | cend () const |
Gets const iterator to the end of the array. | |
constexpr const_reverse_iterator | rbegin () const |
Gets reverse iterator to the beginning of reversed array. | |
constexpr const_reverse_iterator | rend () const |
Gets reverse iterator to the end of reversed array. | |
constexpr const_reverse_iterator | crbegin () const |
Gets const reverse iterator to the beginning of reversed array. | |
constexpr const_reverse_iterator | crend () const |
Gets const reverse iterator to the end of reversed array. | |
constexpr void | zero_null_values (const inner_value_type &value) |
Sets all null values to the specified value. | |
constexpr auto | type_id_map_from_child_to_type_id (const std::optional< R > &child_index_to_type_id) -> type_id_map |
Friends | |
class | union_array_crtp_base< dense_union_array > |
Additional Inherited Members | |
![]() | |
using | type_id_map |
using | children_type |
![]() | |
using | derived_type = D |
![]() | |
constexpr children_type | make_children (arrow_proxy &proxy) |
Creates child array wrappers from Arrow proxy. | |
union_array_crtp_base (arrow_proxy proxy) | |
Protected constructor from Arrow proxy. | |
constexpr | union_array_crtp_base (const self_type &rhs) |
Copy constructor. | |
constexpr self_type & | operator= (const self_type &rhs) |
Copy assignment operator. | |
constexpr | union_array_crtp_base (self_type &&rhs)=default |
constexpr self_type & | operator= (self_type &&rhs)=default |
constexpr arrow_proxy & | get_arrow_proxy () |
Gets mutable reference to the Arrow proxy. | |
constexpr const arrow_proxy & | get_arrow_proxy () const |
Gets const reference to the Arrow proxy. | |
constexpr children_type | make_children (arrow_proxy &proxy) |
Creates child array wrappers from Arrow proxy. | |
union_array_crtp_base (arrow_proxy proxy) | |
Protected constructor from Arrow proxy. | |
constexpr | union_array_crtp_base (const self_type &rhs) |
Copy constructor. | |
constexpr | union_array_crtp_base (self_type &&rhs)=default |
constexpr self_type & | operator= (const self_type &rhs) |
Copy assignment operator. | |
constexpr self_type & | operator= (self_type &&rhs)=default |
constexpr arrow_proxy & | get_arrow_proxy () |
Gets mutable reference to the Arrow proxy. | |
constexpr const arrow_proxy & | get_arrow_proxy () const |
Gets const reference to the Arrow proxy. | |
![]() | |
constexpr derived_type & | derived_cast () |
constexpr const derived_type & | derived_cast () const |
![]() | |
static constexpr type_id_map | parse_type_id_map (std::string_view format_string) |
Parses type ID mapping from Arrow format string. | |
static constexpr type_id_map | type_id_map_from_child_to_type_id (const std::optional< R > &child_index_to_type_id) |
Creates type ID mapping from child index to type ID mapping. | |
static constexpr std::string | make_format_string (bool dense, std::size_t n, const std::optional< R > &child_index_to_type_id) |
Creates Arrow format string for union arrays. | |
static constexpr type_id_map | parse_type_id_map (std::string_view format_string) |
Parses type ID mapping from Arrow format string. | |
static constexpr type_id_map | type_id_map_from_child_to_type_id (const std::optional< R > &child_index_to_type_id) |
Creates type ID mapping from child index to type ID mapping. | |
static constexpr std::string | make_format_string (bool dense, std::size_t n, const std::optional< R > &child_index_to_type_id) |
Creates Arrow format string for union arrays. | |
![]() | |
arrow_proxy | m_proxy |
Internal Arrow proxy. | |
const std::uint8_t * | p_type_ids |
Pointer to type ID buffer. | |
children_type | m_children |
Child array wrappers. | |
std::array< std::uint8_t, TYPE_ID_MAP_SIZE > | m_type_id_map |
Type ID to child index mapping. | |
arrow_proxy | m_proxy |
Internal Arrow proxy. | |
const std::uint8_t * | p_type_ids |
Pointer to type ID buffer. | |
children_type | m_children |
Child array wrappers. | |
std::array< std::uint8_t, TYPE_ID_MAP_SIZE > | m_type_id_map |
Type ID to child index mapping. | |
![]() | |
static constexpr size_t | TYPE_ID_MAP_SIZE |
static constexpr size_t | TYPE_ID_MAP_SIZE |
Dense union array implementation with offset buffer.
Dense union arrays store an additional offset buffer that maps each element to its position within the corresponding child array. This allows child arrays to be densely packed (only containing values that are actually used), making them more memory efficient when union elements are sparse.
Memory layout:
Related Apache Arrow specification: https://arrow.apache.org/docs/dev/format/Columnar.html#dense-union
Definition at line 542 of file union_array.hpp.
Definition at line 546 of file union_array.hpp.
using sparrow::dense_union_array::offset_buffer_type = u8_buffer<std::uint32_t> |
Definition at line 547 of file union_array.hpp.
using sparrow::dense_union_array::type_id_buffer_type = typename base_type::type_id_buffer_type |
Definition at line 548 of file union_array.hpp.
|
inlineexplicit |
Generic constructor for creating dense union arrays.
Creates a dense union array from various input combinations including child arrays, type IDs, offsets, and optional type mapping.
Args | Parameter pack for constructor arguments |
args | Constructor arguments (children, type_ids, offsets, etc.) |
Definition at line 566 of file union_array.hpp.
|
explicit |
Constructs dense union array from Arrow proxy.
proxy | Arrow proxy containing dense union array data and schema |
SPARROW_API sparrow::dense_union_array::dense_union_array | ( | const dense_union_array & | rhs | ) |
Copy constructor.
rhs | Source dense union array to copy from |
|
default |
auto sparrow::dense_union_array::create_proxy_impl | ( | std::vector< array > && | children, |
type_id_buffer_type && | element_type, | ||
offset_buffer_type && | offsets, | ||
std::string && | format, | ||
std::optional< std::string_view > | name, | ||
std::optional< METADATA_RANGE > | metadata ) -> arrow_proxy |
SPARROW_API dense_union_array & sparrow::dense_union_array::operator= | ( | const dense_union_array & | rhs | ) |
Copy assignment operator.
rhs | Source dense union array to copy from |
|
default |
|
friend |
Definition at line 771 of file union_array.hpp.