|
sparrow 2.2.1
C++20 idiomatic APIs for the Apache Arrow Columnar Format
|
CRTP base class providing shared functionality for union array implementations. More...
#include <union_array.hpp>
Public Types | |
| using | self_type = union_array_crtp_base<DERIVED> |
| using | derived_type = DERIVED |
| using | inner_value_type = array_traits::inner_value_type |
| using | value_type = array_traits::const_reference |
| using | const_reference = array_traits::const_reference |
| using | functor_type = detail::layout_bracket_functor<derived_type, value_type> |
| using | const_functor_type = detail::layout_bracket_functor<const derived_type, value_type> |
| using | iterator = functor_index_iterator<functor_type> |
| using | const_iterator = functor_index_iterator<const_functor_type> |
| using | const_reverse_iterator = std::reverse_iterator<const_iterator> |
| using | size_type = std::size_t |
| using | type_id_buffer_type = u8_buffer<std::uint8_t> |
Public Member Functions | |
| 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. | |
| template<std::ranges::input_range R> | |
| constexpr auto | type_id_map_from_child_to_type_id (const std::optional< R > &child_index_to_type_id) -> type_id_map |
Protected Types | |
| using | type_id_map = std::array<std::uint8_t, TYPE_ID_MAP_SIZE> |
| using | children_type = std::vector<cloning_ptr<array_wrapper>> |
Protected Types inherited from sparrow::crtp_base< DERIVED > | |
| using | derived_type |
Protected Member Functions | |
| 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. | |
Protected Member Functions inherited from sparrow::crtp_base< DERIVED > | |
| constexpr derived_type & | derived_cast () |
| constexpr const derived_type & | derived_cast () const |
Static Protected Member Functions | |
| static constexpr type_id_map | parse_type_id_map (std::string_view format_string) |
| Parses type ID mapping from Arrow format string. | |
| template<std::ranges::input_range R> | |
| 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. | |
| template<std::ranges::input_range R> requires (std::convertible_to<std::ranges::range_value_t<R>, std::uint8_t>) | |
| 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. | |
Protected Attributes | |
| 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 Protected Attributes | |
| static constexpr size_t | TYPE_ID_MAP_SIZE = 256 |
Friends | |
| class | detail::array_access |
CRTP base class providing shared functionality for union array implementations.
This class implements the common interface and logic shared between dense and sparse union arrays. Union arrays can store values of different types in a single array, with each element having an associated type ID that indicates which child array contains the actual value.
Key features:
The union array consists of:
| DERIVED | The derived union array type (dense_union_array or sparse_union_array) |
Definition at line 124 of file union_array.hpp.
|
protected |
Definition at line 411 of file union_array.hpp.
| using sparrow::union_array_crtp_base< DERIVED >::const_functor_type = detail::layout_bracket_functor<const derived_type, value_type> |
Definition at line 134 of file union_array.hpp.
| using sparrow::union_array_crtp_base< DERIVED >::const_iterator = functor_index_iterator<const_functor_type> |
Definition at line 136 of file union_array.hpp.
| using sparrow::union_array_crtp_base< DERIVED >::const_reference = array_traits::const_reference |
Definition at line 132 of file union_array.hpp.
| using sparrow::union_array_crtp_base< DERIVED >::const_reverse_iterator = std::reverse_iterator<const_iterator> |
Definition at line 137 of file union_array.hpp.
| using sparrow::union_array_crtp_base< DERIVED >::derived_type = DERIVED |
Definition at line 129 of file union_array.hpp.
| using sparrow::union_array_crtp_base< DERIVED >::functor_type = detail::layout_bracket_functor<derived_type, value_type> |
Definition at line 133 of file union_array.hpp.
| using sparrow::union_array_crtp_base< DERIVED >::inner_value_type = array_traits::inner_value_type |
Definition at line 130 of file union_array.hpp.
| using sparrow::union_array_crtp_base< DERIVED >::iterator = functor_index_iterator<functor_type> |
Definition at line 135 of file union_array.hpp.
| using sparrow::union_array_crtp_base< DERIVED >::self_type = union_array_crtp_base<DERIVED> |
Definition at line 128 of file union_array.hpp.
| using sparrow::union_array_crtp_base< DERIVED >::size_type = std::size_t |
Definition at line 138 of file union_array.hpp.
| using sparrow::union_array_crtp_base< DERIVED >::type_id_buffer_type = u8_buffer<std::uint8_t> |
Definition at line 140 of file union_array.hpp.
|
protected |
Definition at line 363 of file union_array.hpp.
| using sparrow::union_array_crtp_base< DERIVED >::value_type = array_traits::const_reference |
Definition at line 131 of file union_array.hpp.
|
explicitprotected |
Protected constructor from Arrow proxy.
| proxy | Arrow proxy containing union array data and schema |
Definition at line 1034 of file union_array.hpp.
|
constexprprotected |
Copy constructor.
| rhs | Source union array to copy from |
Definition at line 1043 of file union_array.hpp.
|
constexprprotecteddefault |
|
nodiscard |
Gets element at specified position with bounds checking.
| i | Index of the element to access |
| std::out_of_range | if i >= size() |
|
nodiscard |
Gets reference to the last element.
Definition at line 1155 of file union_array.hpp.
|
nodiscardconstexpr |
Gets iterator to the beginning of the array.
Definition at line 1089 of file union_array.hpp.
|
nodiscardconstexpr |
Gets const iterator to the beginning of the array.
Definition at line 1101 of file union_array.hpp.
|
nodiscardconstexpr |
Gets const iterator to the beginning of the array.
Definition at line 1113 of file union_array.hpp.
|
nodiscardconstexpr |
Gets const iterator to the end of the array.
Definition at line 1119 of file union_array.hpp.
|
nodiscardconstexpr |
Gets const reverse iterator to the beginning of reversed array.
Definition at line 1137 of file union_array.hpp.
|
nodiscardconstexpr |
Gets const reverse iterator to the end of reversed array.
Definition at line 1143 of file union_array.hpp.
|
nodiscardconstexpr |
Checks if the union array is empty.
Definition at line 1083 of file union_array.hpp.
|
nodiscardconstexpr |
Gets iterator to the end of the array.
Definition at line 1095 of file union_array.hpp.
|
nodiscardconstexpr |
Gets const iterator to the end of the array.
Definition at line 1107 of file union_array.hpp.
|
nodiscard |
Gets reference to the first element.
Definition at line 1149 of file union_array.hpp.
|
nodiscardconstexprprotected |
Gets mutable reference to the Arrow proxy.
Definition at line 1022 of file union_array.hpp.
|
nodiscardconstexprprotected |
Gets const reference to the Arrow proxy.
Definition at line 1028 of file union_array.hpp.
|
constexprprotected |
Creates child array wrappers from Arrow proxy.
| proxy | Arrow proxy containing child array data |
Definition at line 1161 of file union_array.hpp.
|
staticconstexprprotected |
Creates Arrow format string for union arrays.
| R | Range type for type ID mapping |
| dense | Whether this is a dense union (true) or sparse (false) |
| n | Number of child arrays |
| range | Optional type ID mapping range |
| std::invalid_argument | if range size doesn't match n |
Definition at line 980 of file union_array.hpp.
|
nodiscard |
Gets the metadata associated with the union array.
Definition at line 1016 of file union_array.hpp.
|
nodiscardconstexpr |
Gets the optional name of the union array.
Definition at line 1010 of file union_array.hpp.
|
constexprprotected |
Copy assignment operator.
| rhs | Source union array to copy from |
Definition at line 1049 of file union_array.hpp.
|
constexprprotecteddefault |
|
nodiscard |
Gets mutable element at specified position.
| i | Index of the element to access |
Definition at line 1071 of file union_array.hpp.
|
nodiscard |
Gets element at specified position without bounds checking.
| i | Index of the element to access |
Definition at line 1062 of file union_array.hpp.
|
staticconstexprprotected |
Parses type ID mapping from Arrow format string.
| format_string | Arrow format string containing type ID mappings |
Definition at line 924 of file union_array.hpp.
|
nodiscardconstexpr |
Gets reverse iterator to the beginning of reversed array.
Definition at line 1125 of file union_array.hpp.
|
nodiscardconstexpr |
Gets reverse iterator to the end of reversed array.
Definition at line 1131 of file union_array.hpp.
|
nodiscardconstexpr |
Gets the number of elements in the union array.
Definition at line 1077 of file union_array.hpp.
|
staticconstexprprotected |
Creates type ID mapping from child index to type ID mapping.
| R | Range type containing type IDs |
| child_index_to_type_id | Optional mapping from child index to type ID |
|
constexpr |
Definition at line 951 of file union_array.hpp.
|
inlineconstexpr |
Sets all null values to the specified value.
This operation modifies the underlying data values but not the validity bitmap. The bitmap remains unchanged, so the elements will still be considered null. Only the actual stored values are replaced.
| value | The value to assign to null elements |
Definition at line 354 of file union_array.hpp.
|
friend |
Definition at line 488 of file union_array.hpp.
|
protected |
Child array wrappers.
Definition at line 485 of file union_array.hpp.
|
protected |
Internal Arrow proxy.
Definition at line 483 of file union_array.hpp.
|
protected |
Type ID to child index mapping.
Definition at line 486 of file union_array.hpp.
|
protected |
Pointer to type ID buffer.
Definition at line 484 of file union_array.hpp.
|
staticconstexprprotected |
Definition at line 361 of file union_array.hpp.