30 template <trivial_copyable_type T>
33 template <trivial_copyable_type T>
59 template <trivial_copyable_type T>
96 template <trivial_copyable_type T>
112 using pointer =
typename inner_types::pointer;
150 template <
class... Args>
153 :
base_type(create_proxy(std::forward<Args>(args)...))
172 template <input_metadata_container METADATA_RANGE = std::vector<metadata_pair>>
174 std::initializer_list<inner_value_type> init,
176 std::optional<std::string_view> name = std::nullopt,
177 std::optional<METADATA_RANGE> metadata = std::nullopt
253 [[nodiscard]] static auto create_proxy(
256 VALIDITY_RANGE&& bitmaps,
257 std::optional<
std::string_view> name =
std::nullopt,
258 std::optional<METADATA_RANGE> metadata =
std::nullopt
282 [[nodiscard]] static auto create_proxy(
286 std::optional<
std::string_view> name =
std::nullopt,
287 std::optional<METADATA_RANGE> metadata =
std::nullopt
310 [[nodiscard]] static auto create_proxy(
313 std::optional<
std::string_view> name =
std::nullopt,
314 std::optional<METADATA_RANGE> metadata =
std::nullopt
336 requires
std::convertible_to<U, T>
339 const U& value = U{},
341 std::optional<std::string_view> name = std::nullopt,
342 std::optional<METADATA_RANGE> metadata = std::nullopt
367 std::ranges::input_range R,
370 requires(std::convertible_to<std::ranges::range_value_t<R>, T>)
374 std::optional<std::string_view> name = std::nullopt,
375 std::optional<METADATA_RANGE> metadata = std::nullopt
395 template <std::ranges::input_range NULLABLE_RANGE, input_metadata_container METADATA_RANGE = std::vector<metadata_pair>>
396 requires std::is_same_v<std::ranges::range_value_t<NULLABLE_RANGE>,
nullable<T>>
399 std::optional<std::string_view> name = std::nullopt,
400 std::optional<METADATA_RANGE> metadata = std::nullopt
421 template <input_metadata_container METADATA_RANGE = std::vector<metadata_pair>>
422 [[nodiscard]]
static arrow_proxy create_proxy_impl(
425 std::optional<validity_bitmap>&& bitmap,
426 std::optional<std::string_view> name = std::nullopt,
427 std::optional<METADATA_RANGE> metadata = std::nullopt
443 static constexpr size_type DATA_BUFFER_INDEX = 1;
455 template <trivial_copyable_type T>
462 template <trivial_copyable_type T>
469 template <trivial_copyable_type T>
477 template <trivial_copyable_type T>
484 template <trivial_copyable_type T>
492 template <trivial_copyable_type T>
493 template <val
idity_bitmap_input VALIDITY_RANGE, input_metadata_container METADATA_RANGE>
494 auto primitive_array_impl<T>::create_proxy(
497 VALIDITY_RANGE&& bitmap_input,
498 std::optional<std::string_view> name,
499 std::optional<METADATA_RANGE> metadata
502 return create_proxy_impl(
511 template <trivial_copyable_type T>
512 template <std::ranges::input_range VALUE_RANGE, val
idity_bitmap_input VALIDITY_RANGE, input_metadata_container METADATA_RANGE>
513 requires(std::convertible_to<std::ranges::range_value_t<VALUE_RANGE>, T>)
515 VALUE_RANGE&& values,
516 VALIDITY_RANGE&& validity_input,
517 std::optional<std::string_view> name,
518 std::optional<METADATA_RANGE> metadata
521 auto size =
static_cast<size_t>(std::ranges::distance(values));
523 std::forward<VALUE_RANGE>(values)
526 std::move(data_buffer),
528 std::forward<VALIDITY_RANGE>(validity_input),
534 template <trivial_copyable_type T>
535 template <
class U, input_metadata_container METADATA_RANGE>
536 requires std::convertible_to<U, T>
541 std::optional<std::string_view> name,
542 std::optional<METADATA_RANGE> metadata
547 return create_proxy_impl(
548 std::move(data_buffer),
550 nullable ? std::make_optional<validity_bitmap>(
nullptr, 0) : std::nullopt,
556 template <trivial_copyable_type T>
557 template <val
idity_bitmap_input VALIDITY_RANGE, input_metadata_container METADATA_RANGE>
562 std::optional<std::string_view> name,
563 std::optional<METADATA_RANGE> metadata
566 std::optional<validity_bitmap> bitmap =
nullable ? std::make_optional<validity_bitmap>(
nullptr, 0)
568 return create_proxy_impl(
569 std::move(data_buffer),
577 template <trivial_copyable_type T>
578 template <std::ranges::input_range R, input_metadata_container METADATA_RANGE>
583 std::optional<std::string_view> name,
584 std::optional<METADATA_RANGE> metadata
588 auto distance =
static_cast<size_t>(std::ranges::distance(range));
589 std::optional<validity_bitmap> bitmap =
nullable ? std::make_optional<validity_bitmap>(
nullptr, 0)
591 return create_proxy_impl(
592 std::move(data_buffer),
601 template <trivial_copyable_type T>
602 template <std::ranges::input_range NULLABLE_RANGE, input_metadata_container METADATA_RANGE>
603 requires std::is_same_v<std::ranges::range_value_t<NULLABLE_RANGE>,
nullable<T>>
605 NULLABLE_RANGE&& nullable_range,
606 std::optional<std::string_view> name,
607 std::optional<METADATA_RANGE> metadata
611 auto values = nullable_range
612 | std::views::transform(
618 auto is_non_null = nullable_range
619 | std::views::transform(
622 return v.has_value();
625 return self_type::create_proxy(values, is_non_null, std::move(name), std::move(metadata));
628 template <trivial_copyable_type T>
629 template <input_metadata_container METADATA_RANGE>
630 [[nodiscard]]
arrow_proxy primitive_array_impl<T>::create_proxy_impl(
633 std::optional<validity_bitmap>&& bitmap,
634 std::optional<std::string_view> name,
635 std::optional<METADATA_RANGE> metadata
638 const bool bitmap_has_value = bitmap.has_value();
639 const auto null_count = bitmap_has_value ? bitmap->null_count() : 0;
640 const auto flags = bitmap_has_value
656 buffer<uint8_t> bitmap_buffer = bitmap_has_value ? std::move(*bitmap).extract_storage()
659 std::vector<buffer<uint8_t>> buffers(2);
660 buffers[0] = std::move(bitmap_buffer);
661 buffers[1] = std::move(data_buffer).extract_storage();
665 static_cast<std::int64_t
>(size),
666 static_cast<int64_t
>(null_count),
674 return arrow_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.
Data access class for trivial copyable types.
constexpr void resize_values(size_t new_length, const T &value)
constexpr value_iterator erase_values(const_value_iterator pos, size_t count)
inner_value_type * inner_pointer
constexpr inner_reference value(size_t i)
const T & inner_const_reference
constexpr value_iterator insert_values(const_value_iterator pos, InputIt first, InputIt last)
constexpr value_iterator value_begin()
constexpr value_iterator value_end()
constexpr const_value_iterator value_cend() const
constexpr void reset_proxy(arrow_proxy &proxy)
pointer_iterator< inner_const_pointer > const_value_iterator
const inner_value_type * inner_const_pointer
static constexpr u8_buffer< T > make_data_buffer(RANGE &&r)
constexpr value_iterator insert_value(const_value_iterator pos, T value, size_t count)
pointer_iterator< inner_pointer > value_iterator
constexpr const_value_iterator value_cbegin() const
friend class run_end_encoded_array
typename base_type::value_iterator value_iterator
typename base_type::const_value_iterator const_value_iterator
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)
Constructs a primitive array from an initializer list of raw values.
typename inner_types::pointer pointer
primitive_array_impl< T > self_type
primitive_array_impl(Args &&... args)
Constructs an array of trivial copyable type with values and optional bitmap.
mutable_array_bitmap_base< primitive_array_impl< T > > base_type
primitive_array_impl(arrow_proxy)
Constructs a primitive array from an existing Arrow proxy.
constexpr primitive_array_impl(primitive_array_impl &&) noexcept
Move constructor.
typename inner_types::inner_reference inner_reference
typename inner_types::inner_const_reference inner_const_reference
constexpr primitive_array_impl & operator=(const primitive_array_impl &)
Copy assignment operator.
typename inner_types::const_pointer const_pointer
array_inner_types< self_type > inner_types
details::primitive_data_access< T > access_class_type
typename inner_types::inner_value_type inner_value_type
constexpr primitive_array_impl(const primitive_array_impl &)
Copy constructor.
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.
typename data_access_type::inner_value_type inner_value_type
typename data_access_type::value_iterator value_iterator
details::primitive_data_access< T > data_access_type
typename data_access_type::inner_const_pointer const_pointer
typename data_access_type::inner_const_reference inner_const_reference
std::random_access_iterator_tag iterator_tag
typename data_access_type::inner_pointer pointer
typename data_access_type::inner_reference inner_reference
typename data_access_type::const_value_iterator const_value_iterator
primitive_array_impl< T > array_type
nullable< inner_const_reference, bitmap_const_reference > const_reference
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.