19#if defined(__cpp_lib_format)
86 template <
class... Args>
89 :
struct_array(create_proxy(std::forward<Args>(args)...))
106 template <val
idity_bitmap_input VB = val
idity_bitmap>
107 [[nodiscard]]
static auto create_proxy(
108 std::vector<array>&& children,
110 std::optional<std::string_view> name = std::nullopt,
111 std::optional<std::string_view> metadata = std::nullopt
114 using children_type = std::vector<cloning_ptr<array_wrapper>>;
116 [[nodiscard]]
SPARROW_API value_iterator value_begin();
117 [[nodiscard]]
SPARROW_API value_iterator value_end();
123 [[nodiscard]]
SPARROW_API children_type make_children();
126 children_type m_children;
136 template <val
idity_bitmap_input VB>
137 auto struct_array::create_proxy(
138 std::vector<array>&& children,
140 std::optional<std::string_view> name,
141 std::optional<std::string_view> metadata
144 const auto n_children = children.size();
148 const auto size = children[0].size();
150 for (std::size_t i = 0; i < n_children; ++i)
152 auto& child = children[i];
155 child_arrays[i] =
new ArrowArray(std::move(flat_arr));
156 child_schemas[i] =
new ArrowSchema(std::move(flat_schema));
160 const auto null_count = vbitmap.null_count();
167 static_cast<int64_t
>(n_children),
172 std::vector<buffer<std::uint8_t>> arr_buffs = {std::move(vbitmap).extract_storage()};
175 static_cast<std::int64_t
>(size),
176 static_cast<std::int64_t
>(null_count),
178 std::move(arr_buffs),
179 static_cast<std::size_t
>(n_children),
183 return arrow_proxy{std::move(arr), std::move(schema)};
187#if defined(__cpp_lib_format)
192 constexpr auto parse(std::format_parse_context& ctx)
198 ->
decltype(ctx.out());
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.
Proxy class over ArrowArray and ArrowSchema.
The nullable class models a value or a reference that can be "null", or missing, like values traditio...
array_inner_types< self_type > inner_types
SPARROW_API struct_array(arrow_proxy proxy)
SPARROW_API struct_array(const struct_array &)
SPARROW_API array_wrapper * raw_child(std::size_t i)
SPARROW_API const array_wrapper * raw_child(std::size_t i) const
nullable< inner_value_type > value_type
nullable< inner_const_reference, bitmap_const_reference > const_reference
struct_value inner_reference
struct_array(Args &&... args)
typename base_type::size_type size_type
typename inner_types::value_iterator value_iterator
base_type::iterator_tag iterator_tag
struct_value inner_value_type
typename base_type::bitmap_type bitmap_type
struct_array(struct_array &&)=default
struct_array & operator=(struct_array &&)=default
struct_value inner_const_reference
SPARROW_API struct_array & operator=(const struct_array &)
SPARROW_API size_type children_count() const
base_type::const_bitmap_range const_bitmap_range
typename base_type::bitmap_const_reference bitmap_const_reference
typename inner_types::const_value_iterator const_value_iterator
array_bitmap_base< self_type > base_type
#define SPARROW_ASSERT_TRUE(expr__)
constexpr bool excludes_copy_and_move_ctor_v
ArrowSchema make_arrow_schema(F format, N name, M metadata, std::optional< ArrowFlag > flags, int64_t n_children, ArrowSchema **children, ArrowSchema *dictionary)
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.
constexpr bool is_struc_array_v
Checks whether T is a struct_array type.
std::pair< ArrowArray, ArrowSchema > extract_arrow_structures(A &&a)
Extracts the internal ArrowArrays and ArrowSchema structures from the given array or typed layout.
dynamic_bitset< std::uint8_t > validity_bitmap
std::ostream & operator<<(std::ostream &stream, T n)
validity_bitmap ensure_validity_bitmap(std::size_t size, R &&validity_input)
ArrowArray make_arrow_array(int64_t length, int64_t null_count, int64_t offset, B buffers, size_t n_children, ArrowArray **children, ArrowArray *dictionary)
Creates an ArrowArray.
functor_index_iterator< detail::layout_value_functor< const array_type, inner_value_type > > const_value_iterator
functor_index_iterator< detail::layout_value_functor< array_type, inner_value_type > > value_iterator
struct_value inner_value_type
struct_value inner_reference
std::random_access_iterator_tag iterator_tag
struct_value inner_const_reference
Base class for array_inner_types specialization.
Traits class that must be specialized by array classes inheriting from array_crtp_base.