31 template <trivial_copyable_type T,
typename Ext = empty_extension, trivial_copyable_type T2 = T>
34 template <trivial_copyable_type T,
typename Ext, trivial_copyable_type T2>
60 template <trivial_copyable_type T,
typename Ext, trivial_copyable_type T2>
110 template <trivial_copyable_type T,
typename Ext, trivial_copyable_type T2>
127 using pointer =
typename inner_types::pointer;
165 template <
class... Args>
168 :
base_type(create_proxy(std::forward<Args>(args)...))
187 template <input_metadata_container METADATA_RANGE = std::vector<metadata_pair>>
189 std::initializer_list<inner_value_type> init,
191 std::optional<std::string_view> name = std::nullopt,
192 std::optional<METADATA_RANGE> metadata = std::nullopt
268 [[nodiscard]] static auto create_proxy(
271 VALIDITY_RANGE&& bitmaps,
272 std::optional<
std::string_view> name =
std::nullopt,
273 std::optional<METADATA_RANGE> metadata =
std::nullopt
297 [[nodiscard]] static auto create_proxy(
301 std::optional<
std::string_view> name =
std::nullopt,
302 std::optional<METADATA_RANGE> metadata =
std::nullopt
328 [[nodiscard]] static auto create_proxy(
331 std::optional<
std::string_view> name =
std::nullopt,
332 std::optional<METADATA_RANGE> metadata =
std::nullopt
354 requires
std::convertible_to<U, T2>
357 const U& value = U{},
359 std::optional<std::string_view> name = std::nullopt,
360 std::optional<METADATA_RANGE> metadata = std::nullopt
385 std::ranges::input_range R,
388 requires(std::convertible_to<std::ranges::range_value_t<R>, T2>)
392 std::optional<std::string_view> name = std::nullopt,
393 std::optional<METADATA_RANGE> metadata = std::nullopt
413 template <std::ranges::input_range NULLABLE_RANGE, input_metadata_container METADATA_RANGE = std::vector<metadata_pair>>
414 requires std::is_same_v<std::ranges::range_value_t<NULLABLE_RANGE>,
nullable<T2>>
417 std::optional<std::string_view> name = std::nullopt,
418 std::optional<METADATA_RANGE> metadata = std::nullopt
439 template <input_metadata_container METADATA_RANGE = std::vector<metadata_pair>>
440 [[nodiscard]]
static arrow_proxy create_proxy_impl(
443 std::optional<validity_bitmap>&& bitmap,
444 std::optional<std::string_view> name = std::nullopt,
445 std::optional<METADATA_RANGE> metadata = std::nullopt
461 static constexpr size_type DATA_BUFFER_INDEX = 1;
473 template <trivial_copyable_type T,
typename Ext, trivial_copyable_type T2>
480 template <trivial_copyable_type T,
typename Ext, trivial_copyable_type T2>
487 template <trivial_copyable_type T,
typename Ext, trivial_copyable_type T2>
496 template <trivial_copyable_type T,
typename Ext, trivial_copyable_type T2>
503 template <trivial_copyable_type T,
typename Ext, trivial_copyable_type T2>
512 template <trivial_copyable_type T,
typename Ext, trivial_copyable_type T2>
513 template <val
idity_bitmap_input VALIDITY_RANGE, input_metadata_container METADATA_RANGE>
514 auto primitive_array_impl<T, Ext, T2>::create_proxy(
517 VALIDITY_RANGE&& bitmap_input,
518 std::optional<std::string_view> name,
519 std::optional<METADATA_RANGE> metadata
522 return create_proxy_impl(
531 template <trivial_copyable_type T,
typename Ext, trivial_copyable_type T2>
532 template <std::ranges::input_range VALUE_RANGE, val
idity_bitmap_input VALIDITY_RANGE, input_metadata_container METADATA_RANGE>
533 requires(std::convertible_to<std::ranges::range_value_t<VALUE_RANGE>, T2>)
535 VALUE_RANGE&& values,
536 VALIDITY_RANGE&& validity_input,
537 std::optional<std::string_view> name,
538 std::optional<METADATA_RANGE> metadata
541 auto size =
static_cast<size_t>(std::ranges::distance(values));
543 std::forward<VALUE_RANGE>(values)
546 std::move(data_buffer),
548 std::forward<VALIDITY_RANGE>(validity_input),
554 template <trivial_copyable_type T,
typename Ext, trivial_copyable_type T2>
555 template <
class U, input_metadata_container METADATA_RANGE>
556 requires std::convertible_to<U, T2>
557 arrow_proxy primitive_array_impl<T, Ext, T2>::create_proxy(
561 std::optional<std::string_view> name,
562 std::optional<METADATA_RANGE> metadata
567 return create_proxy_impl(
568 std::move(data_buffer),
570 nullable ? std::make_optional<validity_bitmap>(
nullptr, 0) : std::nullopt,
576 template <trivial_copyable_type T,
typename Ext, trivial_copyable_type T2>
577 template <val
idity_bitmap_input VALIDITY_RANGE, input_metadata_container METADATA_RANGE>
582 std::optional<std::string_view> name,
583 std::optional<METADATA_RANGE> metadata
586 std::optional<validity_bitmap> bitmap =
nullable ? std::make_optional<validity_bitmap>(
nullptr, 0)
588 return create_proxy_impl(
589 std::move(data_buffer),
597 template <trivial_copyable_type T,
typename Ext, trivial_copyable_type T2>
598 template <std::ranges::input_range R, input_metadata_container METADATA_RANGE>
603 std::optional<std::string_view> name,
604 std::optional<METADATA_RANGE> metadata
608 auto distance =
static_cast<size_t>(std::ranges::distance(range));
609 std::optional<validity_bitmap> bitmap =
nullable ? std::make_optional<validity_bitmap>(
nullptr, 0)
611 return create_proxy_impl(
612 std::move(data_buffer),
621 template <trivial_copyable_type T,
typename Ext, trivial_copyable_type T2>
622 template <std::ranges::input_range NULLABLE_RANGE, input_metadata_container METADATA_RANGE>
623 requires std::is_same_v<std::ranges::range_value_t<NULLABLE_RANGE>,
nullable<T2>>
624 arrow_proxy primitive_array_impl<T, Ext, T2>::create_proxy(
625 NULLABLE_RANGE&& nullable_range,
626 std::optional<std::string_view> name,
627 std::optional<METADATA_RANGE> metadata
631 auto values = nullable_range
632 | std::views::transform(
638 auto is_non_null = nullable_range
639 | std::views::transform(
642 return v.has_value();
645 return self_type::create_proxy(values, is_non_null, std::move(name), std::move(metadata));
648 template <trivial_copyable_type T,
typename Ext, trivial_copyable_type T2>
649 template <input_metadata_container METADATA_RANGE>
650 [[nodiscard]]
arrow_proxy primitive_array_impl<T, Ext, T2>::create_proxy_impl(
653 std::optional<validity_bitmap>&& bitmap,
654 std::optional<std::string_view> name,
655 std::optional<METADATA_RANGE> metadata
658 const bool bitmap_has_value = bitmap.has_value();
659 const auto null_count = bitmap_has_value ? bitmap->null_count() : 0;
660 const auto flags = bitmap_has_value
676 buffer<uint8_t> bitmap_buffer = bitmap_has_value ? std::move(*bitmap).extract_storage()
679 std::vector<buffer<uint8_t>> buffers(2);
680 buffers[0] = std::move(bitmap_buffer);
681 buffers[1] = std::move(data_buffer).extract_storage();
685 static_cast<std::int64_t
>(size),
686 static_cast<int64_t
>(null_count),
694 arrow_proxy proxy(std::move(arr), std::move(schema));
constexpr array_bitmap_base_impl & operator=(const array_bitmap_base_impl &)
std::conditional_t< is_mutable, mutable_array_base< D >, array_crtp_base< D > > base_type
Object that owns a piece of contiguous memory.
Provides access to primitive data stored in Arrow format buffers.
constexpr inner_reference value(size_t i)
pointer_iterator< inner_const_pointer > const_value_iterator
inner_value_type * inner_pointer
std::conditional_t< std::is_same_v< T2, bool >, T2, const T2 & > inner_const_reference
const inner_value_type * inner_const_pointer
constexpr const_value_iterator value_cbegin() const
constexpr value_iterator insert_value(const_value_iterator pos, T2 value, size_t count)
static constexpr u8_buffer< T2 > make_data_buffer(RANGE &&r)
constexpr value_iterator value_begin()
constexpr value_iterator value_end()
constexpr const_value_iterator value_cend() const
constexpr void reset_proxy(arrow_proxy &proxy)
constexpr value_iterator insert_values(const_value_iterator pos, InputIt first, InputIt last)
constexpr void resize_values(size_t new_length, const T2 &value)
pointer_iterator< inner_pointer > value_iterator
constexpr value_iterator erase_values(const_value_iterator pos, size_t count)
constexpr primitive_array_impl(primitive_array_impl &&) noexcept
primitive_array_impl< T, Ext, T2 > self_type
friend class run_end_encoded_array
typename inner_types::inner_reference inner_reference
array_inner_types< self_type > inner_types
typename inner_types::inner_value_type inner_value_type
typename base_type::const_value_iterator const_value_iterator
primitive_array_impl(arrow_proxy)
Constructs a primitive array from an existing Arrow proxy.
primitive_array_impl(Args &&... args)
typename inner_types::inner_const_reference inner_const_reference
primitive_array_impl(std::initializer_list< inner_value_type > init, bool nullable=true, std::optional< std::string_view > name=std::nullopt, std::optional< METADATA_RANGE > metadata=std::nullopt)
constexpr primitive_array_impl & operator=(const primitive_array_impl &)
typename inner_types::pointer pointer
typename base_type::value_iterator value_iterator
constexpr primitive_array_impl(const primitive_array_impl &)
typename inner_types::const_pointer const_pointer
details::primitive_data_access< T, T2 > access_class_type
mutable_array_bitmap_base< primitive_array_impl< T, Ext, T2 > > base_type
A view that repeats a value a given number of times.
This buffer class is used as storage buffer for all sparrow arrays.
constexpr bool excludes_copy_and_move_ctor_v
Convenience variable template for excludes_copy_and_move_ctor.
constexpr bool is_type_instance_of_v
Variable template for convenient access to is_type_instance_of.
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.
constexpr std::string_view data_type_to_format(data_type type)
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.
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.
Extensions to the C++ standard library.
std::random_access_iterator_tag iterator_tag
typename data_access_type::inner_const_pointer const_pointer
primitive_array_impl< T, Ext, T2 > array_type
typename data_access_type::const_value_iterator const_value_iterator
typename data_access_type::value_iterator value_iterator
details::primitive_data_access< T, T2 > data_access_type
typename data_access_type::inner_pointer pointer
typename data_access_type::inner_const_reference inner_const_reference
typename data_access_type::inner_reference inner_reference
nullable< inner_const_reference, bitmap_const_reference > const_reference
typename data_access_type::inner_value_type inner_value_type
bitmap_type::const_reference bitmap_const_reference
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.