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;
359 [[nodiscard]] static
arrow_proxy create_proxy_impl(
364 std::int64_t null_count,
366 std::optional<
std::string_view> name,
367 std::optional<METADATA_RANGE> metadata
401 std::optional<
std::string_view> name =
std::nullopt,
402 std::optional<METADATA_RANGE> metadata =
std::nullopt
429 std::
ranges::input_range OFFSET_BUFFER_RANGE,
435 OFFSET_BUFFER_RANGE&& list_offsets_range,
437 std::optional<
std::string_view> name =
std::nullopt,
438 std::optional<METADATA_RANGE> metadata =
std::nullopt
442 return map_array::create_proxy(
443 std::move(flat_keys),
444 std::move(flat_items),
445 std::move(list_offsets),
446 std::forward<VB>(validity_input),
447 std::forward<std::optional<std::string_view>>(name),
448 std::forward<std::optional<METADATA_RANGE>>(metadata)
481 std::optional<std::string_view> name = std::nullopt,
482 std::optional<METADATA_RANGE> metadata = std::nullopt
509 std::ranges::input_range OFFSET_BUFFER_RANGE,
511 requires std::convertible_to<std::ranges::range_value_t<OFFSET_BUFFER_RANGE>,
offset_type>
515 OFFSET_BUFFER_RANGE&& list_offsets_range,
517 std::optional<std::string_view> name = std::nullopt,
518 std::optional<METADATA_RANGE> metadata = std::nullopt
522 return map_array::create_proxy(
523 std::move(flat_keys),
524 std::move(flat_items),
525 std::move(list_offsets),
527 std::forward<std::optional<std::string_view>>(name),
528 std::forward<std::optional<METADATA_RANGE>>(metadata)
532 static constexpr std::size_t OFFSET_BUFFER_INDEX = 1;
535 cloning_ptr<array_wrapper> p_entries_array;
543 template <std::ranges::range SIZES_RANGE>
547 std::forward<SIZES_RANGE>(sizes)
551 template <input_metadata_container METADATA_RANGE>
555 offset_buffer_type&& list_offsets,
557 std::int64_t null_count,
558 std::optional<std::unordered_set<ArrowFlag>> flags,
559 std::optional<std::string_view> name,
560 std::optional<METADATA_RANGE> metadata
563 const auto size = list_offsets.size() - 1;
565 std::array<sparrow::array, 2> struct_children = {std::move(flat_keys), std::move(flat_items)};
566 struct_array entries(std::move(struct_children),
false, std::string(
"entries"));
570 const repeat_view<bool> children_ownership{
true, 1};
577 new ArrowSchema*[1]{
new ArrowSchema(std::move(entries_schema))},
584 std::vector<buffer<std::uint8_t>> arr_buffs = {
585 std::move(validity_buffer),
586 std::move(list_offsets).extract_storage()
590 static_cast<std::int64_t
>(size),
593 std::move(arr_buffs),
594 new ArrowArray*[1]{
new ArrowArray(std::move(entries_arr))},
599 return arrow_proxy{std::move(arr), std::move(schema)};
602 template <val
idity_bitmap_input VB, input_metadata_container METADATA_RANGE>
606 offset_buffer_type&& list_offsets,
608 std::optional<std::string_view> name,
609 std::optional<METADATA_RANGE> metadata
612 const auto size = list_offsets.size() - 1;
616 bool keys_sorted = check_keys_sorted(flat_keys, list_offsets);
622 const auto null_count = vbitmap.null_count();
623 buffer<std::uint8_t> validity_buffer = std::move(vbitmap).extract_storage();
625 return create_proxy_impl(
626 std::move(flat_keys),
627 std::move(flat_items),
628 std::move(list_offsets),
629 std::move(validity_buffer),
630 static_cast<std::int64_t
>(null_count),
633 std::forward<std::optional<METADATA_RANGE>>(metadata)
637 template <val
idity_bitmap_input VB, input_metadata_container METADATA_RANGE>
641 offset_buffer_type&& list_offsets,
643 std::optional<std::string_view> name,
644 std::optional<METADATA_RANGE> metadata
649 return map_array::create_proxy(
650 std::move(flat_keys),
651 std::move(flat_items),
652 std::move(list_offsets),
660 bool keys_sorted = check_keys_sorted(flat_keys, list_offsets);
661 auto flags = keys_sorted
665 return create_proxy_impl(
666 std::move(flat_keys),
667 std::move(flat_items),
668 std::move(list_offsets),
669 buffer<std::uint8_t>{
nullptr, 0},
673 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.
Smart pointer behaving like a copiable std::unique_ptr.
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.