sparrow 1.0.0
Loading...
Searching...
No Matches
fixed_width_binary_array.hpp
Go to the documentation of this file.
1// Copyright 2024 Man Group Operations Limited
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or mplied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#pragma once
16
17#include <cstddef>
18#include <cstdint>
19#include <iterator>
20#include <optional>
21#include <ranges>
22#include <string>
23#include <type_traits>
24#include <vector>
25
40
41namespace sparrow
42{
43 template <std::ranges::sized_range T, class CR>
45
47
78 fixed_width_binary_traits::value_type,
79 fixed_width_binary_traits::const_reference>;
80
81 template <std::ranges::sized_range T, class CR>
108
109 namespace detail
110 {
111 template <>
113 {
114 [[nodiscard]] static constexpr sparrow::data_type get()
115 {
117 }
118 };
119 }
120
121 template <std::ranges::sized_range T, class CR>
123 : public mutable_array_bitmap_base<fixed_width_binary_array_impl<T, CR>>
124 {
125 private:
126
127 static_assert(
128 sizeof(std::ranges::range_value_t<T>) == sizeof(byte_t),
129 "Only sequences of types with the same size as byte_t are supported"
130 );
131
132 public:
133
136
138 using inner_value_type = typename inner_types::inner_value_type;
139 using inner_reference = typename inner_types::inner_reference;
140 using inner_const_reference = typename inner_types::inner_const_reference;
141
143 using bitmap_reference = typename base_type::bitmap_reference;
146
150
154 using data_iterator = typename inner_types::data_iterator;
155
156 using const_data_iterator = typename inner_types::const_data_iterator;
157 using data_value_type = typename inner_types::data_value_type;
158
159 using value_iterator = typename inner_types::value_iterator;
160 using const_value_iterator = typename inner_types::const_value_iterator;
161
162 using functor_type = typename inner_types::functor_type;
163 using const_functor_type = typename inner_types::const_functor_type;
164
179
195 template <class... ARGS>
198 : base_type(create_proxy(std::forward<ARGS>(args)...))
199 , m_element_size(num_bytes_for_fixed_sized_binary(this->get_arrow_proxy().format()))
200 {
201 }
202
203 using base_type::get_arrow_proxy;
204 using base_type::size;
205
217 [[nodiscard]] constexpr inner_reference value(size_type i);
218
230 [[nodiscard]] constexpr inner_const_reference value(size_type i) const;
231
232 private:
233
255 template <
258 input_metadata_container METADATA_RANGE = std::vector<metadata_pair>>
259 [[nodiscard]] static arrow_proxy create_proxy(
260 u8_buffer<C>&& data_buffer,
261 size_t element_count,
262 size_t element_size,
263 VB&& validity_input = validity_bitmap{},
264 std::optional<std::string_view> name = std::nullopt,
265 std::optional<METADATA_RANGE> metadata = std::nullopt
266 );
267
283 template <input_metadata_container METADATA_RANGE = std::vector<metadata_pair>>
284 [[nodiscard]] static arrow_proxy create_proxy(
285 size_t element_size,
286 bool nullable = true,
287 std::optional<std::string_view> name = std::nullopt,
288 std::optional<METADATA_RANGE> metadata = std::nullopt
289 );
290
311 template <
312 std::ranges::input_range VALUES,
314 input_metadata_container METADATA_RANGE = std::vector<metadata_pair>>
315 requires(
316 std::ranges::input_range<std::ranges::range_value_t<VALUES>>
318 )
319 [[nodiscard]] static arrow_proxy create_proxy(
320 VALUES&& values,
321 VB&& validity_input,
322 std::optional<std::string_view> name = std::nullopt,
323 std::optional<METADATA_RANGE> metadata = std::nullopt
324 );
325
345 template <std::ranges::input_range VALUES, input_metadata_container METADATA_RANGE = std::vector<metadata_pair>>
346 requires(
347 std::ranges::input_range<std::ranges::range_value_t<VALUES>>
349 )
350 [[nodiscard]] static arrow_proxy create_proxy(
351 VALUES&& values,
352 bool nullable = true,
353 std::optional<std::string_view> name = std::nullopt,
354 std::optional<METADATA_RANGE> metadata = std::nullopt
355 );
356
374 template <std::ranges::input_range NULLABLE_VALUES, input_metadata_container METADATA_RANGE = std::vector<metadata_pair>>
376 && std::ranges::input_range<typename std::ranges::range_value_t<NULLABLE_VALUES>::value_type>
377 && std::is_same_v<
378 std::ranges::range_value_t<typename std::ranges::range_value_t<NULLABLE_VALUES>::value_type>,
379 byte_t>
380 [[nodiscard]] static arrow_proxy create_proxy(
381 NULLABLE_VALUES&&,
382 std::optional<std::string_view> name = std::nullopt,
383 std::optional<METADATA_RANGE> metadata = std::nullopt
384 );
385
409 template <mpl::char_like C, input_metadata_container METADATA_RANGE = std::vector<metadata_pair>>
410 [[nodiscard]] static arrow_proxy create_proxy_impl(
411 u8_buffer<C>&& data_buffer,
412 size_t element_count,
413 size_t element_size,
414 std::optional<validity_bitmap>&& validity_input,
415 std::optional<std::string_view> name = std::nullopt,
416 std::optional<METADATA_RANGE> metadata = std::nullopt
417 );
418
419 static constexpr size_t DATA_BUFFER_INDEX = 1;
420
432 [[nodiscard]] constexpr data_iterator data(size_type i);
433
441 [[nodiscard]] constexpr value_iterator value_begin();
442
450 [[nodiscard]] constexpr value_iterator value_end();
451
459 [[nodiscard]] constexpr const_value_iterator value_cbegin() const;
460
468 [[nodiscard]] constexpr const_value_iterator value_cend() const;
469
481 [[nodiscard]] constexpr const_data_iterator data(size_type i) const;
482
483 // Modifiers
484
501 template <std::ranges::sized_range U>
503 constexpr void resize_values(size_type new_length, U value);
504
524 template <std::ranges::sized_range U>
526 constexpr value_iterator insert_value(const_value_iterator pos, U value, size_type count);
527
553 template <typename InputIt>
554 requires std::input_iterator<InputIt>
556 constexpr value_iterator insert_values(const_value_iterator pos, InputIt first, InputIt last);
557
576 constexpr value_iterator erase_values(const_value_iterator pos, size_type count);
577
594 template <std::ranges::sized_range U>
596 constexpr void assign(U&& rhs, size_type index);
597
598 size_t m_element_size = 0;
599
602 friend base_type;
605 };
606
607 /************************************************
608 * fixed_width_binary_array_impl implementation *
609 ************************************************/
610
611 template <std::ranges::sized_range T, class CR>
613 : base_type(std::move(proxy))
614 , m_element_size(num_bytes_for_fixed_sized_binary(this->get_arrow_proxy().format()))
615 {
616 SPARROW_ASSERT_TRUE(this->get_arrow_proxy().data_type() == data_type::FIXED_WIDTH_BINARY);
617 }
618
619 template <std::ranges::sized_range T, class CR>
620 template <mpl::char_like C, validity_bitmap_input VB, input_metadata_container METADATA_RANGE>
621 arrow_proxy fixed_width_binary_array_impl<T, CR>::create_proxy(
622 u8_buffer<C>&& data_buffer,
623 size_t element_count,
624 size_t element_size,
625 VB&& validity_input,
626 std::optional<std::string_view> name,
627 std::optional<METADATA_RANGE> metadata
628 )
629 {
630 validity_bitmap bitmap = ensure_validity_bitmap(element_count, std::forward<VB>(validity_input));
631 return create_proxy_impl(
632 std::move(data_buffer),
633 element_count,
634 element_size,
635 std::move(bitmap),
636 std::move(name),
637 std::move(metadata)
638 );
639 }
640
641 template <std::ranges::sized_range T, class CR>
642 template <input_metadata_container METADATA_RANGE>
643 arrow_proxy fixed_width_binary_array_impl<T, CR>::create_proxy(
644 size_t element_size,
645 bool nullable,
646 std::optional<std::string_view> name,
647 std::optional<METADATA_RANGE> metadata
648 )
649 {
650 u8_buffer<char> data_buffer{};
651 std::optional<validity_bitmap> bitmap = nullable ? std::make_optional<validity_bitmap>(nullptr, 0)
652 : std::nullopt;
653 return create_proxy_impl(
654 std::move(data_buffer),
655 0,
656 element_size,
657 std::move(bitmap),
658 std::move(name),
659 std::move(metadata)
660 );
661 }
662
663 template <std::ranges::sized_range T, class CR>
664 template <std::ranges::input_range R, validity_bitmap_input VB, input_metadata_container METADATA_RANGE>
665 requires(
666 std::ranges::input_range<std::ranges::range_value_t<R>> && // a range of ranges
668 // range of char-like
669 )
670 arrow_proxy fixed_width_binary_array_impl<T, CR>::create_proxy(
671 R&& values,
672 VB&& validity_input,
673 std::optional<std::string_view> name,
674 std::optional<METADATA_RANGE> metadata
675 )
676 {
677 using values_type = std::ranges::range_value_t<R>;
678 using values_inner_value_type = std::ranges::range_value_t<values_type>;
679
681 const size_t element_size = std::ranges::empty(values) ? 0 : std::ranges::size(*values.begin());
682
683 auto data_buffer = u8_buffer<values_inner_value_type>(std::ranges::views::join(values));
684 return create_proxy(
685 std::move(data_buffer),
686 values.size(),
687 element_size,
688 std::forward<VB>(validity_input),
689 std::forward<std::optional<std::string_view>>(name),
690 std::forward<std::optional<METADATA_RANGE>>(metadata)
691 );
692 }
693
694 template <std::ranges::sized_range T, class CR>
695 template <std::ranges::input_range R, input_metadata_container METADATA_RANGE>
696 requires(
697 std::ranges::input_range<std::ranges::range_value_t<R>> && // a range of ranges
699 // range of char-like
700 )
701 arrow_proxy fixed_width_binary_array_impl<T, CR>::create_proxy(
702 R&& values,
703 bool nullable,
704 std::optional<std::string_view> name,
705 std::optional<METADATA_RANGE> metadata
706 )
707 {
708 if (nullable)
709 {
710 return create_proxy(std::forward<R>(values), validity_bitmap{}, std::move(name), std::move(metadata));
711 }
712 else
713 {
714 using values_type = std::ranges::range_value_t<R>;
715 using values_inner_value_type = std::ranges::range_value_t<values_type>;
716
718 const size_t element_size = std::ranges::empty(values) ? 0 : std::ranges::size(*values.begin());
719 auto data_buffer = u8_buffer<values_inner_value_type>(std::ranges::views::join(values));
720 return create_proxy_impl(
721 std::move(data_buffer),
722 values.size(), // element count
723 element_size,
724 std::nullopt, // validity bitmap
725 std::move(name),
726 std::move(metadata)
727 );
728 }
729 }
730
731 template <std::ranges::sized_range T, class CR>
732 template <std::ranges::input_range NULLABLE_RANGE, input_metadata_container METADATA_RANGE>
734 && std::ranges::input_range<typename std::ranges::range_value_t<NULLABLE_RANGE>::value_type>
735 && std::is_same_v<
736 std::ranges::range_value_t<typename std::ranges::range_value_t<NULLABLE_RANGE>::value_type>,
737 byte_t>
738 arrow_proxy fixed_width_binary_array_impl<T, CR>::create_proxy(
739 NULLABLE_RANGE&& range,
740 std::optional<std::string_view> name,
741 std::optional<METADATA_RANGE> metadata
742 )
743 {
744 // split into values and is_non_null ranges
745 const auto values = range
746 | std::views::transform(
747 [](const auto& v)
748 {
749 return v.get();
750 }
751 );
752 const auto is_non_null = range
753 | std::views::transform(
754 [](const auto& v)
755 {
756 return v.has_value();
757 }
758 );
759 return self_type::create_proxy(values, is_non_null, std::move(name), std::move(metadata));
760 }
761
762 template <std::ranges::sized_range T, class CR>
763 template <mpl::char_like C, input_metadata_container METADATA_RANGE>
764 arrow_proxy fixed_width_binary_array_impl<T, CR>::create_proxy_impl(
765 u8_buffer<C>&& data_buffer,
766 size_t element_count,
767 size_t element_size,
768 std::optional<validity_bitmap>&& bitmap,
769 std::optional<std::string_view> name,
770 std::optional<METADATA_RANGE> metadata
771 )
772 {
774 element_size == 0 ? (data_buffer.size() == 0) : (data_buffer.size() % element_size == 0)
775 );
776
777 const auto null_count = bitmap.has_value() ? bitmap->null_count() : 0;
778 std::string format_str = "w:" + std::to_string(element_size);
779 const std::optional<std::unordered_set<ArrowFlag>>
780 flags = bitmap.has_value()
781 ? std::make_optional<std::unordered_set<ArrowFlag>>({ArrowFlag::NULLABLE})
782 : std::nullopt;
783
785 std::move(format_str),
786 std::move(name), // name
787 std::move(metadata), // metadata
788 flags, // flags,
789 nullptr, // children
790 repeat_view<bool>(true, 0), // children_ownership
791 nullptr, // dictionary
792 true // dictionary ownership
793
794 );
795 std::vector<buffer<std::uint8_t>> arr_buffs = {
796 bitmap.has_value() ? std::move(*bitmap).extract_storage() : buffer<std::uint8_t>{nullptr, 0},
797 std::move(data_buffer).extract_storage()
798 };
799
800 ArrowArray arr = make_arrow_array(
801 static_cast<std::int64_t>(element_count), // length
802 static_cast<int64_t>(null_count),
803 0, // offset
804 std::move(arr_buffs),
805 nullptr, // children
806 repeat_view<bool>(true, 0), // children_ownership
807 nullptr, // dictionary
808 true // dictionary ownership
809 );
810 return arrow_proxy{std::move(arr), std::move(schema)};
811 }
812
813 template <std::ranges::sized_range T, class CR>
814 constexpr auto fixed_width_binary_array_impl<T, CR>::data(size_type i) -> data_iterator
815 {
816 const arrow_proxy& proxy = this->get_arrow_proxy();
817 auto data_buffer = proxy.buffers()[DATA_BUFFER_INDEX];
818 const size_t data_buffer_size = data_buffer.size();
819 const size_type index_offset = (static_cast<size_type>(proxy.offset()) * m_element_size) + i;
820 SPARROW_ASSERT_TRUE(data_buffer_size >= index_offset);
821 return data_buffer.template data<data_value_type>() + index_offset;
822 }
823
824 template <std::ranges::sized_range T, class CR>
825 constexpr auto fixed_width_binary_array_impl<T, CR>::data(size_type i) const -> const_data_iterator
826 {
827 const arrow_proxy& proxy = this->get_arrow_proxy();
828 const auto data_buffer = proxy.buffers()[DATA_BUFFER_INDEX];
829 const size_t data_buffer_size = data_buffer.size();
830 const size_type index_offset = (static_cast<size_type>(proxy.offset()) * m_element_size) + i;
831 SPARROW_ASSERT_TRUE(data_buffer_size >= index_offset);
832 return data_buffer.template data<const data_value_type>() + index_offset;
833 }
834
835 template <std::ranges::sized_range T, class CR>
836 template <std::ranges::sized_range U>
838 constexpr void fixed_width_binary_array_impl<T, CR>::assign(U&& rhs, size_type index)
839 {
840 SPARROW_ASSERT_TRUE(std::ranges::size(rhs) == m_element_size);
841 SPARROW_ASSERT_TRUE(index < size());
842 std::copy(std::ranges::begin(rhs), std::ranges::end(rhs), data(index * m_element_size));
843 }
844
845 template <std::ranges::sized_range T, class CR>
847 {
848 SPARROW_ASSERT_TRUE(i < size());
849 return inner_reference(this, i);
850 }
851
852 template <std::ranges::sized_range T, class CR>
854 {
855 SPARROW_ASSERT_TRUE(i < this->size());
856 const auto offset_begin = i * m_element_size;
857 const auto offset_end = offset_begin + m_element_size;
858 const const_data_iterator pointer_begin = data(static_cast<size_type>(offset_begin));
859 const const_data_iterator pointer_end = data(static_cast<size_type>(offset_end));
860 return inner_const_reference(pointer_begin, pointer_end);
861 }
862
863 template <std::ranges::sized_range T, class CR>
864 constexpr auto fixed_width_binary_array_impl<T, CR>::value_begin() -> value_iterator
865 {
866 return value_iterator{functor_type{&(this->derived_cast())}, 0};
867 }
868
869 template <std::ranges::sized_range T, class CR>
870 constexpr auto fixed_width_binary_array_impl<T, CR>::value_end() -> value_iterator
871 {
872 return sparrow::next(value_begin(), size());
873 }
874
875 template <std::ranges::sized_range T, class CR>
876 constexpr auto fixed_width_binary_array_impl<T, CR>::value_cbegin() const -> const_value_iterator
877 {
878 return const_value_iterator{const_functor_type{&(this->derived_cast())}, 0};
879 }
880
881 template <std::ranges::sized_range T, class CR>
882 constexpr auto fixed_width_binary_array_impl<T, CR>::value_cend() const -> const_value_iterator
883 {
884 return sparrow::next(value_cbegin(), this->size());
885 }
886
887 template <std::ranges::sized_range T, class CR>
888 template <std::ranges::sized_range U>
890 constexpr void fixed_width_binary_array_impl<T, CR>::resize_values(size_type new_length, U value)
891 {
892 SPARROW_ASSERT_TRUE(m_element_size == value.size());
893 if (new_length < size())
894 {
895 arrow_proxy& proxy = this->get_arrow_proxy();
896 const size_t new_size = new_length + static_cast<size_t>(proxy.offset());
897 const auto offset = new_size * m_element_size;
898 auto& data_buffer = proxy.get_array_private_data()->buffers()[DATA_BUFFER_INDEX];
899 data_buffer.resize(offset);
900 }
901 else if (new_length > size())
902 {
903 insert_value(value_cend(), value, new_length - size());
904 }
905 }
906
907 template <std::ranges::sized_range T, class CR>
908 template <std::ranges::sized_range U>
910 constexpr auto
911 fixed_width_binary_array_impl<T, CR>::insert_value(const_value_iterator pos, U value, size_type count)
913 {
914 SPARROW_ASSERT_TRUE(m_element_size == value.size());
915 const auto idx = static_cast<size_t>(std::distance(value_cbegin(), pos));
916
917 const uint8_t* uint8_ptr = reinterpret_cast<const uint8_t*>(value.data());
918 const std::vector<uint8_t> casted_value(uint8_ptr, uint8_ptr + value.size());
919 const repeat_view<std::vector<uint8_t>> my_repeat_view{casted_value, count};
920 const auto joined_repeated_value_range = std::ranges::views::join(my_repeat_view);
921 arrow_proxy& proxy = this->get_arrow_proxy();
922 auto& data_buffer = proxy.get_array_private_data()->buffers()[DATA_BUFFER_INDEX];
923 const auto offset_begin = (idx + proxy.offset()) * m_element_size;
924 const auto pos_to_insert = sparrow::next(data_buffer.cbegin(), offset_begin);
925 data_buffer.insert(pos_to_insert, joined_repeated_value_range.begin(), joined_repeated_value_range.end());
926 return sparrow::next(value_begin(), idx);
927 }
928
929 template <std::ranges::sized_range T, class CR>
930 template <typename InputIt>
931 requires std::input_iterator<InputIt>
933 constexpr auto
934 fixed_width_binary_array_impl<T, CR>::insert_values(const_value_iterator pos, InputIt first, InputIt last)
936 {
937 SPARROW_ASSERT_TRUE(value_cbegin() <= pos)
938 SPARROW_ASSERT_TRUE(pos <= value_cend());
939 SPARROW_ASSERT_TRUE(first <= last);
940 SPARROW_ASSERT_TRUE(all_same_size(std::ranges::subrange(first, last)));
941 SPARROW_ASSERT_TRUE(m_element_size == std::ranges::size(*first));
942
943 auto values = std::ranges::subrange(first, last);
944 const size_t cumulative_sizes = values.size() * m_element_size;
945 auto& data_buffer = get_arrow_proxy().get_array_private_data()->buffers()[DATA_BUFFER_INDEX];
946 data_buffer.resize(data_buffer.size() + cumulative_sizes);
947 const auto idx = static_cast<size_t>(std::distance(value_cbegin(), pos));
948 sequence_view<byte_t> casted_values{reinterpret_cast<byte_t*>(data_buffer.data()), data_buffer.size()};
949 const auto offset_begin = m_element_size * (idx + get_arrow_proxy().offset());
950 auto insert_pos = sparrow::next(casted_values.begin(), offset_begin);
951
952 // Move elements to make space for the new value
953 std::move_backward(
954 insert_pos,
955 sparrow::next(casted_values.end(), -static_cast<difference_type>(cumulative_sizes)),
956 casted_values.end()
957 );
958
959 for (const auto& val : values)
960 {
961 std::copy(val.begin(), val.end(), insert_pos);
962 std::advance(insert_pos, m_element_size);
963 }
964 return sparrow::next(value_begin(), idx);
965 }
966
967 template <std::ranges::sized_range T, class CR>
968 constexpr auto fixed_width_binary_array_impl<T, CR>::erase_values(const_value_iterator pos, size_type count)
969 -> value_iterator
970 {
971 SPARROW_ASSERT_TRUE(pos >= value_cbegin());
972 SPARROW_ASSERT_TRUE(pos <= value_cend());
973 const size_t index = static_cast<size_t>(std::distance(value_cbegin(), pos));
974 if (count == 0)
975 {
976 return sparrow::next(value_begin(), index);
977 }
978 auto& data_buffer = get_arrow_proxy().get_array_private_data()->buffers()[DATA_BUFFER_INDEX];
979 const size_type byte_count = m_element_size * count;
980 const auto offset_begin = m_element_size * (index + static_cast<size_type>(get_arrow_proxy().offset()));
981 const auto offset_end = offset_begin + byte_count;
982 // move the values after the erased ones
983 std::move(
984 data_buffer.begin() + static_cast<difference_type>(offset_end),
985 data_buffer.end(),
986 data_buffer.begin() + static_cast<difference_type>(offset_begin)
987 );
988 data_buffer.resize(data_buffer.size() - byte_count);
989 return sparrow::next(value_begin(), index);
990 }
991}
typename base_type::const_bitmap_range const_bitmap_range
typename base_type::iterator_tag iterator_tag
std::conditional_t< is_mutable, mutable_array_base< D >, array_crtp_base< D > > base_type
typename base_type::bitmap_const_reference bitmap_const_reference
typename base_type::bitmap_type bitmap_type
typename base_type::difference_type difference_type
constexpr BufferType & buffers() noexcept
SPARROW_API size_t offset() const
Gets the starting offset within the buffers.
SPARROW_API arrow_array_private_data * get_array_private_data()
bitset_iterator< self_type, true > const_iterator
fixed_width_binary_array_impl(arrow_proxy)
Constructs fixed-width binary array from Arrow proxy.
fixed_width_binary_array_impl(ARGS &&... args)
Generic constructor for creating fixed-width binary array.
constexpr inner_const_reference value(size_type i) const
Gets const reference to element at specified index.
constexpr inner_reference value(size_type i)
Gets mutable reference to element at specified index.
A view that repeats a value a given number of times.
The class sequence_view describes an object that can refer to a constant contiguous sequence of T wit...
This buffer class is used as storage buffer for all sparrow arrays.
Concept for input containers that can provide metadata pairs.
Definition metadata.hpp:304
Concept for character-like types.
Concept for convertible range types.
Definition mp_utils.hpp:931
Concept defining valid input types for validity bitmap creation.
#define SPARROW_ASSERT_TRUE(expr__)
constexpr std::size_t size(typelist< T... >={})
Gets the count of types contained in a typelist.
Definition mp_utils.hpp:216
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.
Definition mp_utils.hpp:102
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.
std::byte byte_t
constexpr bool all_same_size(const Range &range)
Definition ranges.hpp:46
arrow_traits< std::vector< byte_t > > fixed_width_binary_traits
constexpr InputIt next(InputIt it, Distance n)
Definition iterator.hpp:503
fixed_width_binary_array_impl< fixed_width_binary_traits::value_type, fixed_width_binary_traits::const_reference > fixed_width_binary_array
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.
SPARROW_API std::size_t num_bytes_for_fixed_sized_binary(std::string_view format)
Get the number of bytes for a fixed width binary layout from the ArrowArray format string.
validity_bitmap ensure_validity_bitmap(std::size_t size, R &&validity_input)
Ensures a validity bitmap of the specified size from various input types.
data_type
Runtime identifier of arrow data types, usually associated with raw bytes with the associated value.
detail::layout_value_functor< array_type, inner_reference > functor_type
detail::layout_value_functor< const array_type, inner_const_reference > const_functor_type
Base class for array_inner_types specializations.
Traits class that must be specialized by array implementations.
Provides compile-time information about Arrow data types.
Metafunction for retrieving the data_type of a typed array.