sparrow 2.6.0
C++20 idiomatic APIs for the Apache Arrow Columnar Format
Loading...
Searching...
No Matches
union_array.hpp File Reference
#include <algorithm>
#include <array>
#include <charconv>
#include <cstdint>
#include <functional>
#include <iterator>
#include <limits>
#include <numeric>
#include <optional>
#include <ranges>
#include <span>
#include <string>
#include <string_view>
#include <type_traits>
#include <utility>
#include <variant>
#include <vector>
#include "sparrow/array_api.hpp"
#include "sparrow/arrow_interface/arrow_flag_utils.hpp"
#include "sparrow/config/config.hpp"
#include "sparrow/layout/array_access.hpp"
#include "sparrow/layout/array_factory.hpp"
#include "sparrow/layout/array_helper.hpp"
#include "sparrow/layout/array_wrapper.hpp"
#include "sparrow/layout/layout_utils.hpp"
#include "sparrow/layout/nested_value_types.hpp"
#include "sparrow/u8_buffer.hpp"
#include "sparrow/utils/contracts.hpp"
#include "sparrow/utils/crtp_base.hpp"
#include "sparrow/utils/functor_index_iterator.hpp"
#include "sparrow/utils/memory.hpp"
#include "sparrow/utils/metadata.hpp"
#include "sparrow/utils/mp_utils.hpp"
#include "sparrow/utils/nullable.hpp"
Include dependency graph for union_array.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  sparrow::detail::get_data_type_from_array< sparrow::dense_union_array >
struct  sparrow::detail::get_data_type_from_array< sparrow::sparse_union_array >
struct  sparrow::detail::union_rebuild_value
 One row of a rebuild plan. More...
struct  sparrow::detail::union_rebuild_payload
 Rebuilt data of a union array: the row plan of each child, plus the new type-ID and (dense-only) offset buffers. More...
class  sparrow::union_array_crtp_base< DERIVED >
 CRTP base class providing shared functionality for union array implementations. More...
struct  sparrow::union_array_crtp_base< DERIVED >::union_child_schema
 Schema of one child of a rebuilt union array. More...
class  sparrow::dense_union_array
 Dense union array implementation with offset buffer. More...
class  sparrow::sparse_union_array
 Sparse union array implementation without offset buffer. More...

Namespaces

namespace  sparrow
namespace  sparrow::detail
namespace  sparrow::detail::union_rebuild

Typedefs

using sparrow::detail::union_rebuild::dynamic_value = array_traits::value_type
using sparrow::detail::union_rebuild::rebuild_value = detail::union_rebuild_value
using sparrow::detail::union_rebuild::union_rebuild_payload = detail::union_rebuild_payload

Functions

template<class D>
constexpr bool sparrow::operator== (const union_array_crtp_base< D > &lhs, const union_array_crtp_base< D > &rhs)
 Equality comparison operator for union arrays.
SPARROW_API array sparrow::detail::union_rebuild::make_null_child (std::size_t count, const arrow_proxy &child_proxy)
std::size_t sparrow::detail::union_rebuild::next_free_type_id (std::span< const bool > used_type_ids)
 Finds an existing type ID not yet assigned, or TYPE_ID_MAP_SIZE if none is free.
std::size_t sparrow::detail::union_rebuild::child_of (const rebuild_value &value, std::span< const std::size_t > inserted_children)
 Resolves the child a plan entry targets: inserted values carry no child index, only the index of the value they insert.
array sparrow::detail::union_rebuild::make_empty_child (const array_wrapper &child)
template<class T>
dynamic_value sparrow::detail::union_rebuild::make_null_dynamic_value (const T &value)
 Builds a null dynamic value holding the type of the given inner value.
dynamic_value sparrow::detail::union_rebuild::make_null_like (const dynamic_value &value)
 Creates a null-like dynamic value for the given dynamic value.
union_rebuild_payload sparrow::detail::union_rebuild::make_dense_rebuild_payload (std::span< const rebuild_value > values, std::span< const std::size_t > inserted_children, std::span< const std::uint8_t > child_type_ids)
 Creates a rebuild payload for a dense union array.
union_rebuild_payload sparrow::detail::union_rebuild::make_sparse_rebuild_payload (std::span< const rebuild_value > values, std::span< const std::size_t > inserted_children, std::span< const std::uint8_t > child_type_ids, std::span< const rebuild_value > fillers)
 Creates a rebuild payload for a sparse union array.
array sparrow::detail::union_rebuild::make_filler_row (const array &old_child_view, std::size_t row)
 Slices the row a filler rebuild value refers to, marked as null.
void sparrow::detail::union_rebuild::append_old_child_values (array &destination, const array &old_child_view, std::size_t first_row, std::size_t count)
 Appends count consecutive rows of an old child, in a single insertion.
template<typename CHILDREN>
void sparrow::detail::union_rebuild::append_rebuild_values (array &destination, std::span< const rebuild_value > values, std::span< const dynamic_value > inserted, std::span< const std::size_t > inserted_children, const CHILDREN &old_children)
 Appends the rebuild rows of one child to destination.
template<input_metadata_container METADATA_RANGE = std::vector<metadata_pair>>
arrow_proxy sparrow::detail::create_union_proxy_impl (std::vector< array > &&children, std::vector< buffer< std::uint8_t > > &&buffers, std::size_t size, std::string &&format, std::optional< std::string_view > name, std::optional< METADATA_RANGE > metadata)

Variables

constexpr std::size_t sparrow::detail::union_no_child = std::numeric_limits<std::size_t>::max()
template<class T>
constexpr bool sparrow::is_dense_union_array_v = std::same_as<T, dense_union_array>
 Type trait to check if a type is a dense_union_array.
template<class T>
constexpr bool sparrow::is_sparse_union_array_v = std::same_as<T, sparse_union_array>
 Type trait to check if a type is a sparse_union_array.