118 using base_type::insert;
119 using base_type::push_back;
120 using base_type::resize;
152 template <
class... Args>
155 :
self_type(create_proxy(std::forward<Args>(args)...))
239 template <
std::
ranges::range SIZES_RANGE>
282 template <
std::input_iterator InputIt>
339 [[nodiscard]]
SPARROW_API bool get_keys_sorted() const;
384 [[nodiscard]] static
arrow_proxy create_proxy_impl(
389 std::int64_t null_count,
391 std::optional<
std::string_view> name,
392 std::optional<METADATA_RANGE> metadata
426 std::optional<
std::string_view> name =
std::nullopt,
427 std::optional<METADATA_RANGE> metadata =
std::nullopt
454 std::
ranges::input_range OFFSET_BUFFER_RANGE,
460 OFFSET_BUFFER_RANGE&& list_offsets_range,
462 std::optional<
std::string_view> name =
std::nullopt,
463 std::optional<METADATA_RANGE> metadata =
std::nullopt
467 return map_array::create_proxy(
468 std::move(flat_keys),
469 std::move(flat_items),
470 std::move(list_offsets),
471 std::forward<VB>(validity_input),
472 std::forward<std::optional<std::string_view>>(name),
473 std::forward<std::optional<METADATA_RANGE>>(metadata)
506 std::optional<std::string_view> name = std::nullopt,
507 std::optional<METADATA_RANGE> metadata = std::nullopt
534 std::ranges::input_range OFFSET_BUFFER_RANGE,
536 requires std::convertible_to<std::ranges::range_value_t<OFFSET_BUFFER_RANGE>,
offset_type>
540 OFFSET_BUFFER_RANGE&& list_offsets_range,
542 std::optional<std::string_view> name = std::nullopt,
543 std::optional<METADATA_RANGE> metadata = std::nullopt
547 return map_array::create_proxy(
548 std::move(flat_keys),
549 std::move(flat_items),
550 std::move(list_offsets),
552 std::forward<std::optional<std::string_view>>(name),
553 std::forward<std::optional<METADATA_RANGE>>(metadata)
557 static constexpr std::size_t OFFSET_BUFFER_INDEX = 1;
558 cloning_ptr<array_wrapper> p_entries_array;
559 bool m_keys_sorted{};
568 template <std::ranges::range SIZES_RANGE>
572 std::forward<SIZES_RANGE>(sizes)
576 template <std::input_iterator InputIt>
577 requires std::convertible_to<typename std::iterator_traits<InputIt>::value_type,
map_value>
581 const auto index =
static_cast<size_type>(std::distance(value_cbegin(), pos));
583 for (
auto it = first; it != last; ++it, ++count)
586 std::next(value_cbegin(),
static_cast<std::ptrdiff_t
>(index + count)),
591 return std::next(value_begin(),
static_cast<std::ptrdiff_t
>(index));
594 template <input_metadata_container METADATA_RANGE>
598 offset_buffer_type&& list_offsets,
600 std::int64_t null_count,
601 std::optional<std::unordered_set<ArrowFlag>> flags,
602 std::optional<std::string_view> name,
603 std::optional<METADATA_RANGE> metadata
606 const auto size = list_offsets.size() - 1;
608 std::array<sparrow::array, 2> struct_children = {std::move(flat_keys), std::move(flat_items)};
609 struct_array entries(std::move(struct_children),
false, std::string(
"entries"));
615 ArrowSchema** child_schemas =
new ArrowSchema*[1];
616 child_schemas[0] =
new ArrowSchema(std::move(entries_schema));
630 std::vector<buffer<std::uint8_t>> arr_buffs;
631 arr_buffs.reserve(2);
632 arr_buffs.emplace_back(std::move(validity_buffer));
633 arr_buffs.emplace_back(std::move(list_offsets).extract_storage());
635 ArrowArray** child_arrays =
new ArrowArray*[1];
636 child_arrays[0] =
new ArrowArray(std::move(entries_arr));
639 static_cast<std::int64_t
>(size),
642 std::move(arr_buffs),
648 return arrow_proxy{std::move(arr), std::move(schema)};
651 template <val
idity_bitmap_input VB, input_metadata_container METADATA_RANGE>
655 offset_buffer_type&& list_offsets,
657 std::optional<std::string_view> name,
658 std::optional<METADATA_RANGE> metadata
661 const auto size = list_offsets.size() - 1;
665 const bool keys_sorted = check_keys_sorted(flat_keys, list_offsets);
671 const auto null_count = vbitmap.null_count();
672 buffer<std::uint8_t> validity_buffer = std::move(vbitmap).extract_storage();
674 return create_proxy_impl(
675 std::move(flat_keys),
676 std::move(flat_items),
677 std::move(list_offsets),
678 std::move(validity_buffer),
679 static_cast<std::int64_t
>(null_count),
682 std::forward<std::optional<METADATA_RANGE>>(metadata)
686 template <val
idity_bitmap_input VB, input_metadata_container METADATA_RANGE>
690 offset_buffer_type&& list_offsets,
692 std::optional<std::string_view> name,
693 std::optional<METADATA_RANGE> metadata
698 return map_array::create_proxy(
699 std::move(flat_keys),
700 std::move(flat_items),
701 std::move(list_offsets),
709 bool keys_sorted = check_keys_sorted(flat_keys, list_offsets);
710 auto flags = keys_sorted
714 return create_proxy_impl(
715 std::move(flat_keys),
716 std::move(flat_items),
717 std::move(list_offsets),
723 std::forward<std::optional<METADATA_RANGE>>(metadata)
typename base_type::const_bitmap_range const_bitmap_range
typename base_type::iterator_tag iterator_tag
typename base_type::bitmap_const_reference bitmap_const_reference
typename base_type::bitmap_type bitmap_type
Base class for array type erasure.
Dynamically typed array encapsulating an Arrow layout.
Object that owns a piece of contiguous memory.
xsimd::aligned_allocator< T > default_allocator
typename storage_type::default_allocator default_allocator
inner_types::inner_const_reference inner_const_reference
inner_types::const_value_iterator const_value_iterator
typename base_type::iterator_tag iterator_tag
nullable< inner_value_type > value_type
std::span< const std::int32_t > offset_span_type
SPARROW_API map_array & operator=(const self_type &rhs)
Copy assignment operator.
SPARROW_API map_array(const self_type &rhs)
Copy constructor.
inner_types::inner_value_type inner_value_type
map_array(Args &&... args)
Generic constructor for creating map array from various inputs.
typename base_type::iterator iterator
mutable_array_bitmap_base< self_type > base_type
typename base_type::const_bitmap_range const_bitmap_range
SPARROW_API const array_wrapper * raw_items_array() const
Gets read-only access to the values array.
inner_types::value_iterator value_iterator
static auto offset_from_sizes(SIZES_RANGE &&sizes) -> offset_buffer_type
Creates offset buffer from map sizes.
map_array(map_array &&) noexcept=default
SPARROW_API const array_wrapper * raw_keys_array() const
Gets read-only access to the keys array.
inner_types::inner_reference inner_reference
const std::int32_t offset_type
u8_buffer< std::remove_const_t< offset_type > > offset_buffer_type
typename base_type::bitmap_type bitmap_type
SPARROW_API map_array(arrow_proxy proxy)
Constructs map array from Arrow proxy.
nullable< inner_const_reference, bitmap_const_reference > const_reference
array_inner_types< self_type > inner_types
typename base_type::size_type size_type
typename base_type::const_iterator const_iterator
typename base_type::bitmap_const_reference bitmap_const_reference
Base class definining common interface for arrays with a bitmap.
This buffer class is used as storage buffer for all sparrow arrays.
constexpr sparrow::u8_buffer< OFFSET_TYPE > offset_buffer_from_sizes(SIZES_RANGE &&sizes)
constexpr std::size_t size(typelist< T... >={})
Gets the count of types contained in a typelist.
constexpr bool excludes_copy_and_move_ctor_v
Convenience variable template for excludes_copy_and_move_ctor.
array_bitmap_base_impl< D, true > mutable_array_bitmap_base
Convenient alias for arrays with mutable validity bitmaps.
ArrowSchema make_arrow_schema(F format, N name, std::optional< M > metadata, std::optional< std::unordered_set< ArrowFlag > > flags, ArrowSchema **children, const CHILDREN_OWNERSHIP &children_ownership, ArrowSchema *dictionary, bool dictionary_ownership)
Creates an ArrowSchema owned by a unique_ptr and holding the provided data.
std::pair< ArrowArray, ArrowSchema > extract_arrow_structures(A &&a)
Extracts the internal ArrowArray and ArrowSchema structures from the given array or typed layout.
ArrowArray make_arrow_array(int64_t length, int64_t null_count, int64_t offset, B buffers, ArrowArray **children, const CHILDREN_OWNERSHIP &children_ownership, ArrowArray *dictionary, bool dictionary_ownership)
Creates an ArrowArray.
dynamic_bitset< std::uint8_t > validity_bitmap
Type alias for a validity bitmap using 8-bit storage blocks.
constexpr bool is_map_array_v
validity_bitmap ensure_validity_bitmap(std::size_t size, R &&validity_input)
Ensures a validity bitmap of the specified size from various input types.
std::pair< metadata_key, metadata_value > metadata_pair
Type alias for metadata key-value pairs.
repeat_view(T &, size_t) -> repeat_view< T & >
data_type
Runtime identifier of arrow data types, usually associated with raw bytes with the associated value.
Extensions to the C++ standard library.
map_value inner_const_reference
functor_index_iterator< detail::layout_value_functor< array_type, inner_value_type > > value_iterator
std::random_access_iterator_tag iterator_tag
map_value inner_reference
functor_index_iterator< detail::layout_value_functor< const array_type, inner_value_type > > const_value_iterator
map_value inner_value_type
Base class for array_inner_types specializations.
Traits class that must be specialized by array implementations.
static constexpr sparrow::data_type get()
Metafunction for retrieving the data_type of a typed array.