143 template <
class... Args>
146 :
self_type(create_proxy(std::forward<Args>(args)...))
230 template <
std::
ranges::range SIZES_RANGE>
320 [[nodiscard]]
SPARROW_API bool get_keys_sorted() const;
371 std::optional<
std::string_view> name =
std::nullopt,
372 std::optional<METADATA_RANGE> metadata =
std::nullopt
399 std::
ranges::input_range OFFSET_BUFFER_RANGE,
405 OFFSET_BUFFER_RANGE&& list_offsets_range,
407 std::optional<
std::string_view> name =
std::nullopt,
408 std::optional<METADATA_RANGE> metadata =
std::nullopt
412 return map_array::create_proxy(
413 std::move(flat_keys),
414 std::move(flat_items),
415 std::move(list_offsets),
416 std::forward<VB>(validity_input),
417 std::forward<std::optional<std::string_view>>(name),
418 std::forward<std::optional<METADATA_RANGE>>(metadata)
451 std::optional<std::string_view> name = std::nullopt,
452 std::optional<METADATA_RANGE> metadata = std::nullopt
479 std::ranges::input_range OFFSET_BUFFER_RANGE,
481 requires std::convertible_to<std::ranges::range_value_t<OFFSET_BUFFER_RANGE>,
offset_type>
485 OFFSET_BUFFER_RANGE&& list_offsets_range,
487 std::optional<std::string_view> name = std::nullopt,
488 std::optional<METADATA_RANGE> metadata = std::nullopt
492 return map_array::create_proxy(
493 std::move(flat_keys),
494 std::move(flat_items),
495 std::move(list_offsets),
497 std::forward<std::optional<std::string_view>>(name),
498 std::forward<std::optional<METADATA_RANGE>>(metadata)
502 static constexpr std::size_t OFFSET_BUFFER_INDEX = 1;
505 cloning_ptr<array_wrapper> p_entries_array;
513 template <std::ranges::range SIZES_RANGE>
517 std::forward<SIZES_RANGE>(sizes)
521 template <val
idity_bitmap_input VB, input_metadata_container METADATA_RANGE>
525 offset_buffer_type&& list_offsets,
527 std::optional<std::string_view> name,
528 std::optional<METADATA_RANGE> metadata
531 const auto size = list_offsets.size() - 1;
535 bool keys_sorted = check_keys_sorted(flat_keys, list_offsets);
541 std::array<sparrow::array, 2> struct_children = {std::move(flat_keys), std::move(flat_items)};
542 struct_array entries(std::move(struct_children),
false, std::string(
"entries"));
547 const repeat_view<bool> children_ownership{
true, 1};
554 new ArrowSchema*[1]{
new ArrowSchema(std::move(entries_schema))},
561 std::vector<buffer<std::uint8_t>> arr_buffs = {
562 std::move(vbitmap).extract_storage(),
563 std::move(list_offsets).extract_storage()
567 static_cast<std::int64_t
>(size),
568 static_cast<std::int64_t
>(null_count),
570 std::move(arr_buffs),
571 new ArrowArray*[1]{
new ArrowArray(std::move(entries_arr))},
576 return arrow_proxy{std::move(arr), std::move(schema)};
579 template <val
idity_bitmap_input VB, input_metadata_container METADATA_RANGE>
583 offset_buffer_type&& list_offsets,
585 std::optional<std::string_view> name,
586 std::optional<METADATA_RANGE> metadata
591 return map_array::create_proxy(
592 std::move(flat_keys),
593 std::move(flat_items),
594 std::move(list_offsets),
602 bool keys_sorted = check_keys_sorted(flat_keys, list_offsets);
603 auto flags = keys_sorted
607 const auto size = list_offsets.size() - 1;
609 std::array<sparrow::array, 2> struct_children = {std::move(flat_keys), std::move(flat_items)};
610 struct_array entries(std::move(struct_children),
false, std::string(
"entries"));
613 const repeat_view<bool> children_ownership{
true, 1};
616 std::string_view(
"+m"),
620 new ArrowSchema*[1]{
new ArrowSchema(std::move(entries_schema))},
627 std::vector<buffer<std::uint8_t>> arr_buffs = {
628 buffer<std::uint8_t>{
nullptr, 0},
629 std::move(list_offsets).extract_storage()
633 static_cast<std::int64_t
>(size),
636 std::move(arr_buffs),
637 new ArrowArray*[1]{
new ArrowArray(std::move(entries_arr))},
642 return arrow_proxy{std::move(arr), std::move(schema)};
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.
Smart pointer behaving like a copiable std::unique_ptr.
constexpr size_type null_count() const noexcept
Returns the number of bits set to false (null/invalid).
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
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::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
array_bitmap_base< self_type > base_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::bitmap_const_reference bitmap_const_reference
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.
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.
array_bitmap_base_impl< D, false > array_bitmap_base
Convenient alias for arrays with immutable validity bitmaps.
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.
data_type
Runtime identifier of arrow data types, usually associated with raw bytes with the associated value.
map_value inner_const_reference
functor_index_iterator< detail::layout_value_functor< array_type, inner_value_type > > value_iterator
functor_index_iterator< detail::layout_value_functor< const array_type, inner_value_type > > const_value_iterator
std::random_access_iterator_tag iterator_tag
map_value inner_reference
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.