74 template <
class... Args>
77 :
self_type(create_proxy(std::forward<Args>(args)...))
106 [[nodiscard]]
offset_type* make_list_offsets() const;
108 [[nodiscard]]
bool get_keys_sorted() const;
120 std::optional<
std::string_view> name =
std::nullopt,
121 std::optional<METADATA_RANGE> metadata =
std::nullopt
126 std::
ranges::input_range OFFSET_BUFFER_RANGE,
132 OFFSET_BUFFER_RANGE&& list_offsets_range,
134 std::optional<
std::string_view> name =
std::nullopt,
135 std::optional<METADATA_RANGE> metadata =
std::nullopt
139 return map_array::create_proxy(
140 std::move(flat_keys),
141 std::move(flat_items),
142 std::move(list_offsets),
143 std::forward<VB>(validity_input),
144 std::forward<std::optional<std::string_view>>(name),
145 std::forward<std::optional<METADATA_RANGE>>(metadata)
155 offset_buffer_type&& list_offsets,
157 std::optional<std::string_view> name = std::nullopt,
158 std::optional<METADATA_RANGE> metadata = std::nullopt
163 std::ranges::input_range OFFSET_BUFFER_RANGE,
165 requires std::convertible_to<std::ranges::range_value_t<OFFSET_BUFFER_RANGE>, offset_type>
169 OFFSET_BUFFER_RANGE&& list_offsets_range,
171 std::optional<std::string_view> name = std::nullopt,
172 std::optional<METADATA_RANGE> metadata = std::nullopt
175 offset_buffer_type list_offsets{std::move(list_offsets_range)};
176 return map_array::create_proxy(
177 std::move(flat_keys),
178 std::move(flat_items),
179 std::move(list_offsets),
181 std::forward<std::optional<std::string_view>>(name),
182 std::forward<std::optional<METADATA_RANGE>>(metadata)
186 static constexpr std::size_t OFFSET_BUFFER_INDEX = 1;
187 offset_type* p_list_offsets;
189 cloning_ptr<array_wrapper> p_entries_array;
197 template <std::ranges::range SIZES_RANGE>
201 std::forward<SIZES_RANGE>(sizes)
205 template <val
idity_bitmap_input VB, input_metadata_container METADATA_RANGE>
209 offset_buffer_type&& list_offsets,
211 std::optional<std::string_view> name,
212 std::optional<METADATA_RANGE> metadata
215 const auto size = list_offsets.size() - 1;
219 bool keys_sorted = check_keys_sorted(flat_keys, list_offsets);
225 std::array<sparrow::array, 2> struct_children = {std::move(flat_keys), std::move(flat_items)};
226 struct_array entries(std::move(struct_children),
false, std::string(
"entries"));
231 const repeat_view<bool> children_ownership{
true, 1};
238 new ArrowSchema*[1]{
new ArrowSchema(std::move(entries_schema))},
245 std::vector<buffer<std::uint8_t>> arr_buffs = {
246 std::move(vbitmap).extract_storage(),
247 std::move(list_offsets).extract_storage()
251 static_cast<std::int64_t
>(size),
252 static_cast<std::int64_t
>(null_count),
254 std::move(arr_buffs),
255 new ArrowArray*[1]{
new ArrowArray(std::move(entries_arr))},
260 return arrow_proxy{std::move(arr), std::move(schema)};
263 template <val
idity_bitmap_input VB, input_metadata_container METADATA_RANGE>
267 offset_buffer_type&& list_offsets,
269 std::optional<std::string_view> name,
270 std::optional<METADATA_RANGE> metadata
275 return map_array::create_proxy(
276 std::move(flat_keys),
277 std::move(flat_items),
278 std::move(list_offsets),
286 bool keys_sorted = check_keys_sorted(flat_keys, list_offsets);
287 auto flags = keys_sorted
291 const auto size = list_offsets.size() - 1;
293 std::array<sparrow::array, 2> struct_children = {std::move(flat_keys), std::move(flat_items)};
294 struct_array entries(std::move(struct_children),
false, std::string(
"entries"));
297 const repeat_view<bool> children_ownership{
true, 1};
300 std::string_view(
"+m"),
304 new ArrowSchema*[1]{
new ArrowSchema(std::move(entries_schema))},
311 std::vector<buffer<std::uint8_t>> arr_buffs = {
312 buffer<std::uint8_t>{
nullptr, 0},
313 std::move(list_offsets).extract_storage()
317 static_cast<std::int64_t
>(size),
320 std::move(arr_buffs),
321 new ArrowArray*[1]{
new ArrowArray(std::move(entries_arr))},
326 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 defining common immutable interface for arrays with a bitmap.
Base class for array type erasure.
Dynamically typed array encapsulating an Arrow layout.
Proxy class over ArrowArray and ArrowSchema.
Smart pointer behaving like a copiable std::unique_ptr.
constexpr size_type null_count() const noexcept
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
map_array(arrow_proxy proxy)
inner_types::inner_value_type inner_value_type
map_array & operator=(const self_type &)
map_array(Args &&... args)
const array_wrapper * raw_keys_array() const
map_array(const self_type &)
typename base_type::const_bitmap_range const_bitmap_range
inner_types::value_iterator value_iterator
static auto offset_from_sizes(SIZES_RANGE &&sizes) -> offset_buffer_type
map_array(map_array &&) noexcept=default
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
const array_wrapper * raw_items_array() const
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
The nullable class models a value or a reference that can be "null", or missing, like values traditio...
This buffer class is use 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... >={})
constexpr bool excludes_copy_and_move_ctor_v
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 typedef to be used as a crtp base class for arrays using an immutable validity buffer.
std::pair< ArrowArray, ArrowSchema > extract_arrow_structures(A &&a)
Extracts the internal ArrowArrays 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
constexpr bool is_map_array_v
validity_bitmap ensure_validity_bitmap(std::size_t size, R &&validity_input)
std::pair< metadata_key, metadata_value > metadata_pair
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 specialization.
Traits class that must be specialized by array classes inheriting from array_crtp_base.