71 template <
class... Args>
102 [[nodiscard]] std::optional<std::string_view>
name()
const;
103 [[nodiscard]] std::optional<key_value_view>
metadata()
const;
107 template <input_metadata_container METADATA_RANGE = std::vector<metadata_pair>>
108 [[nodiscard]]
static auto create_proxy(
110 array&& encoded_values,
111 std::optional<std::string_view>
name = std::nullopt,
112 std::optional<METADATA_RANGE>
metadata = std::nullopt
115 using acc_length_ptr_variant_type = std::variant<const std::int16_t*, const std::int32_t*, const std::int64_t*>;
117 [[nodiscard]]
SPARROW_API static std::pair<std::int64_t, std::int64_t>
118 extract_length_and_null_count(
const array&,
const array&);
119 [[nodiscard]]
SPARROW_API static acc_length_ptr_variant_type
121 [[nodiscard]]
SPARROW_API std::uint64_t get_run_length(std::uint64_t run_index)
const;
127 std::uint64_t m_encoded_length;
131 acc_length_ptr_variant_type m_acc_lengths;
142 template <input_metadata_container METADATA_RANGE>
143 auto run_end_encoded_array::create_proxy(
145 array&& encoded_values,
146 std::optional<std::string_view> name,
147 std::optional<METADATA_RANGE> metadata
151 auto [null_count, length] = extract_length_and_null_count(acc_lengths, encoded_values);
156 constexpr auto n_children = 2;
160 child_schemas[0] =
new ArrowSchema(std::move(acc_length_schema));
161 child_schemas[1] =
new ArrowSchema(std::move(encoded_values_schema));
163 child_arrays[0] =
new ArrowArray(std::move(acc_length_array));
164 child_arrays[1] =
new ArrowArray(std::move(encoded_values_array));
179 std::vector<buffer<std::uint8_t>> arr_buffs = {};
182 static_cast<std::int64_t
>(length),
183 static_cast<int64_t
>(null_count),
185 std::move(arr_buffs),
192 return arrow_proxy{std::move(arr), std::move(schema)};
197#if defined(__cpp_lib_format)
200struct std::formatter<
sparrow::run_end_encoded_array>
202 constexpr auto parse(std::format_parse_context& ctx)
207 SPARROW_API auto format(
const sparrow::run_end_encoded_array& ar, std::format_context& ctx)
const
208 ->
decltype(ctx.out());
Base class for array type erasure.
Dynamically typed array encapsulating an Arrow layout.
SPARROW_API std::unordered_set< ArrowFlag > flags() const
Gets the Arrow flags set for this array.
Smart pointer behaving like a copiable std::unique_ptr.
static const sparrow::arrow_proxy & get_arrow_proxy(const ARRAY &array)
A view that repeats a value a given number of times.
SPARROW_API const_iterator end() const
SPARROW_API array_traits::const_reference operator[](std::uint64_t i)
array_traits::value_type value_type
std::optional< key_value_view > metadata() const
array_traits::const_reference const_reference
run_encoded_array_iterator< true > const_iterator
array_traits::inner_value_type inner_value_type
SPARROW_API size_type size() const
SPARROW_API array_traits::const_reference back() const
SPARROW_API bool empty() const
SPARROW_API iterator end()
SPARROW_API iterator begin()
SPARROW_API const_iterator begin() const
self_type & operator=(self_type &&)=default
SPARROW_API array_traits::const_reference operator[](std::uint64_t i) const
SPARROW_API run_end_encoded_array(const self_type &)
run_end_encoded_array(self_type &&)=default
SPARROW_API run_end_encoded_array(arrow_proxy proxy)
std::optional< std::string_view > name() const
SPARROW_API array_traits::const_reference front() const
SPARROW_API const_iterator cend() const
SPARROW_API self_type & operator=(const self_type &)
run_end_encoded_array self_type
run_end_encoded_array(Args &&... args)
SPARROW_API const_iterator cbegin() const
run_encoded_array_iterator< false > iterator
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.
SPARROW_API bool operator==(const array &lhs, const array &rhs)
Compares the content of two arrays.
constexpr bool is_run_end_encoded_array_v
Checks whether T is a run_end_encoded_array type.
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.
data_type
Runtime identifier of arrow data types, usually associated with raw bytes with the associated value.
std::ostream & operator<<(std::ostream &os, const sparrow::nullval_t &)
mpl::rename< mpl::unique< mpl::transform< detail::array_const_reference_t, all_base_types_t > >, nullable_variant > const_reference
mpl::rename< all_base_types_t, std::variant > inner_value_type
mpl::rename< mpl::transform< detail::array_value_type_t, all_base_types_t >, nullable_variant > value_type
static constexpr sparrow::data_type get()
Metafunction for retrieving the data_type of a typed array.