155 [[nodiscard]]
constexpr std::optional<std::string_view>
name()
const;
165 [[nodiscard]] std::optional<key_value_view>
metadata()
const;
175 [[nodiscard]]
constexpr bool empty()
const;
485#if defined(__cpp_lib_format)
486 friend struct std::formatter<D>;
526 const std::string error_message =
"Index " + std::to_string(i)
527 +
" is greater or equal to size of array ("
528 + std::to_string(
size()) +
")";
529 throw std::out_of_range(error_message);
553 return (*
this)[
size() - 1];
618 : m_proxy(
std::move(proxy))
695 return std::ranges::equal(lhs, rhs);
699#if defined(__cpp_lib_format)
702 requires std::derived_from<D, sparrow::array_crtp_base<D>>
703struct std::formatter<D>
705 constexpr auto parse(std::format_parse_context& ctx)
710 auto format(
const D& ar, std::format_context& ctx)
const
712 const auto& proxy = ar.get_arrow_proxy();
714 if (proxy.dictionary())
716 std::format_to(ctx.out(),
"Dictionary<{}>", proxy.dictionary()->data_type());
720 std::format_to(ctx.out(),
"{}", proxy.data_type());
722 std::format_to(ctx.out(),
" [name={} | size={}] <", ar.name().value_or(
"nullptr"), proxy.length());
726 std::prev(ar.cend()),
727 [&ctx](
const auto& value)
729 std::format_to(ctx.out(),
"{}, ", value);
732 return std::format_to(ctx.out(),
"{}>", ar.back());
738 template <
typename D>
739 requires std::derived_from<D, array_crtp_base<D>>
740 std::ostream&
operator<<(std::ostream& os,
const D& value)
742 os << std::format(
"{}", value);
constexpr const_bitmap_iterator bitmap_cbegin() const
Gets const bitmap iterator to the beginning.
constexpr const_value_range values() const
Gets the raw values as a range.
array_crtp_base(arrow_proxy)
Protected constructor from Arrow proxy.
constexpr const_reverse_iterator rbegin() const
Gets reverse iterator to the beginning of reversed array.
constexpr D slice_view(size_type start, size_type end) const
Creates a sliced view of the array.
constexpr const_reference back() const
Gets reference to the last element.
typename inner_types::const_value_iterator const_value_iterator
bitmap_type::const_reference bitmap_const_reference
std::ranges::subrange< const_value_iterator > const_value_range
bitmap_type::iterator bitmap_iterator
constexpr const_reference front() const
Gets reference to the first element.
constexpr const_bitmap_iterator bitmap_end() const
Gets bitmap iterator to the end.
constexpr const_bitmap_iterator bitmap_cend() const
Gets const bitmap iterator to the end.
constexpr bool empty() const
Checks if the array is empty.
nullable< inner_const_reference, bitmap_const_reference > const_reference
constexpr const_iterator cbegin() const
Gets const iterator to the beginning of the array.
constexpr const_reference at(size_type i) const
Gets element at specified position with bounds checking.
typename inner_types::iterator_tag iterator_tag
constexpr bitmap_const_reference has_value(size_type i) const
Checks if element at index i has a valid value.
constexpr array_crtp_base(const array_crtp_base &)=default
std::ranges::subrange< const_bitmap_iterator > const_bitmap_range
friend class detail::array_access
typename inner_types::bitmap_type bitmap_type
bitmap_type::const_iterator const_bitmap_iterator
constexpr const_reverse_iterator crbegin() const
Gets const reverse iterator to the beginning of reversed array.
typename inner_types::inner_const_reference inner_const_reference
constexpr const_reverse_iterator crend() const
Gets const reverse iterator to the end of reversed array.
nullable< inner_value_type > value_type
std::ptrdiff_t difference_type
constexpr const_reference operator[](size_type i) const
Gets element at specified position without bounds checking.
layout_iterator< iterator_types > const_iterator
constexpr arrow_proxy & get_arrow_proxy() noexcept
Gets mutable reference to the Arrow proxy.
array_crtp_base< D > self_type
std::reverse_iterator< const_iterator > const_reverse_iterator
constexpr const_iterator cend() const
Gets const iterator to the end of the array.
constexpr array_crtp_base & operator=(const array_crtp_base &)=default
constexpr const_bitmap_iterator bitmap_begin() const
Gets bitmap iterator to the beginning.
array_inner_types< derived_type > inner_types
constexpr const_reverse_iterator rend() const
Gets reverse iterator to the end of reversed array.
constexpr std::optional< std::string_view > name() const
Gets the optional name of the array.
constexpr const_iterator end() const
Gets iterator to the end of the array.
constexpr D slice(size_type start, size_type end) const
Creates a sliced copy of the array.
constexpr array_crtp_base(array_crtp_base &&) noexcept=default
constexpr const_iterator begin() const
Gets iterator to the beginning of the array.
constexpr const_bitmap_range bitmap() const
Gets the validity bitmap as a range.
std::optional< key_value_view > metadata() const
Gets the metadata associated with the array.
typename inner_types::inner_value_type inner_value_type
constexpr size_type size() const
Gets the number of elements in the array.
Base class for CRTP base classes.
constexpr derived_type & derived_cast()
A non-owning view to a dynamic size sequence of bits stored in external memory.
constexpr bitmap_iterator bitmap_end()
base_type::const_reference const_reference
bitmap_type::const_reference bitmap_const_reference
base_type::const_iterator const_iterator
constexpr bitmap_reference has_value(size_type i)
base_type::size_type size_type
base_type::const_bitmap_range const_bitmap_range
constexpr iterator end()
Returns a iterator to the element following the last element of the array.
constexpr bitmap_iterator bitmap_begin()
Concept for iterator types.
#define SPARROW_ASSERT_TRUE(expr__)
SPARROW_API bool operator==(const array &lhs, const array &rhs)
Compares the content of two arrays.
constexpr InputIt next(InputIt it, Distance n)
std::ostream & operator<<(std::ostream &os, const nullval_t &)
self_type::const_reference reference
self_type::const_bitmap_iterator bitmap_iterator
self_type::iterator_tag iterator_tag
self_type::value_type value_type
self_type::const_value_iterator value_iterator
Base class for array_inner_types specializations.
dynamic_bitset_view< std::uint8_t > bitmap_type
Traits class that must be specialized by array implementations.