sparrow 0.9.0
Loading...
Searching...
No Matches
dictionary_encoded_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 <optional>
18
19#include "sparrow/array_api.hpp"
35
36namespace sparrow
37{
44 template <class Layout, bool is_const>
46 {
47 public:
48
49 using layout_type = Layout;
50 using storage_type = std::conditional_t<is_const, const layout_type*, layout_type>;
51 using return_type = std::
52 conditional_t<is_const, typename layout_type::const_reference, typename layout_type::reference>;
53
57 constexpr layout_element_functor() = default;
58
64 constexpr explicit layout_element_functor(storage_type layout_)
65 : p_layout(layout_)
66 {
67 }
68
75 [[nodiscard]] constexpr return_type operator()(std::size_t i) const
76 {
77 return p_layout->operator[](i);
78 }
79
80 private:
81
83 storage_type p_layout;
84 };
85
91 template <std::integral IT>
92 class dictionary_encoded_array;
93
94 namespace detail
95 {
96 template <std::integral IT>
98 {
104 [[nodiscard]] static constexpr sparrow::data_type get() noexcept
105 {
107 }
108 };
109
115 template <std::integral IT>
117 {
123 [[nodiscard]] static constexpr bool get() noexcept
124 {
125 return true;
126 }
127 };
128 }
129
135 template <class T>
137
148 template <std::integral IT>
150 {
151 public:
152
154 using size_type = std::size_t;
155 using difference_type = std::ptrdiff_t;
156
158
162
165
167 using reverse_iterator = std::reverse_iterator<iterator>;
169 using const_reverse_iterator = std::reverse_iterator<const_iterator>;
170
172
179
185 constexpr dictionary_encoded_array(const self_type& other);
186
193 constexpr self_type& operator=(const self_type& other);
194
201
208 constexpr self_type& operator=(self_type&& other);
209
215 [[nodiscard]] constexpr std::optional<std::string_view> name() const;
216
222 [[nodiscard]] std::optional<key_value_view> metadata() const;
223
229 [[nodiscard]] constexpr size_type size() const;
230
236 [[nodiscard]] constexpr bool empty() const;
237
245
251 [[nodiscard]] constexpr iterator begin();
252
258 [[nodiscard]] constexpr iterator end();
259
265 [[nodiscard]] constexpr const_iterator begin() const;
266
272 [[nodiscard]] constexpr const_iterator end() const;
273
279 [[nodiscard]] constexpr const_iterator cbegin() const;
280
286 [[nodiscard]] constexpr const_iterator cend() const;
287
293 [[nodiscard]] constexpr reverse_iterator rbegin();
294
300 [[nodiscard]] constexpr reverse_iterator rend();
301
307 [[nodiscard]] constexpr const_reverse_iterator rbegin() const;
308
314 [[nodiscard]] constexpr const_reverse_iterator rend() const;
315
321 [[nodiscard]] constexpr const_reverse_iterator crbegin() const;
322
328 [[nodiscard]] constexpr const_reverse_iterator crend() const;
329
336
343
350 template <class... Args>
352 explicit dictionary_encoded_array(Args&&... args)
353 : dictionary_encoded_array(create_proxy(std::forward<Args>(args)...))
354 {
355 }
356
366 [[nodiscard]] constexpr self_type slice(size_type start, size_type end) const;
367
377 [[nodiscard]] constexpr self_type slice_view(size_type start, size_type end) const;
378
379 private:
380
393 template <
395 input_metadata_container METADATA_RANGE = std::vector<metadata_pair>>
396 [[nodiscard]] static auto create_proxy(
397 keys_buffer_type&& keys,
398 array&& values,
399 R&& bitmaps,
400 std::optional<std::string_view> name = std::nullopt,
401 std::optional<METADATA_RANGE> metadata = std::nullopt
402 ) -> arrow_proxy;
403
416 template <
418 input_metadata_container METADATA_RANGE = std::vector<metadata_pair>>
419 [[nodiscard]] static auto create_proxy(
420 keys_buffer_type&& keys,
421 array&& values,
422 bool nullable = true,
423 std::optional<std::string_view> name = std::nullopt,
424 std::optional<METADATA_RANGE> metadata = std::nullopt
425 ) -> arrow_proxy;
426
438 template <input_metadata_container METADATA_RANGE = std::vector<metadata_pair>>
439 [[nodiscard]] static auto create_proxy_impl(
440 keys_buffer_type&& keys,
441 array&& values,
442 std::optional<validity_bitmap> validity = std::nullopt,
443 std::optional<std::string_view> name = std::nullopt,
444 std::optional<METADATA_RANGE> metadata = std::nullopt
445 ) -> arrow_proxy;
446
460 template <
461 std::ranges::input_range KEY_RANGE,
463 input_metadata_container METADATA_RANGE = std::vector<metadata_pair>>
464 requires(
465 !std::same_as<KEY_RANGE, keys_buffer_type>
466 and std::same_as<IT, std::ranges::range_value_t<KEY_RANGE>>
467 )
468 [[nodiscard]] static arrow_proxy create_proxy(
469 KEY_RANGE&& keys,
470 array&& values,
471 R&& bitmaps = validity_bitmap{},
472 std::optional<std::string_view> name = std::nullopt,
473 std::optional<METADATA_RANGE> metadata = std::nullopt
474 )
475 {
476 keys_buffer_type keys_buffer(std::forward<KEY_RANGE>(keys));
477 return create_proxy(
478 std::move(keys_buffer),
479 std::forward<array>(values),
480 std::forward<R>(bitmaps),
481 std::move(name),
482 std::move(metadata)
483 );
484 }
485
497 template <
498 std::ranges::input_range NULLABLE_KEY_RANGE,
499 input_metadata_container METADATA_RANGE = std::vector<metadata_pair>>
500 requires std::is_same_v<std::ranges::range_value_t<NULLABLE_KEY_RANGE>, nullable<IT>>
501 static arrow_proxy create_proxy(
502 NULLABLE_KEY_RANGE&& nullable_keys,
503 array&& values,
504 std::optional<std::string_view> name = std::nullopt,
505 std::optional<METADATA_RANGE> metadata = std::nullopt
506 );
507
508 using keys_layout = primitive_array<IT>;
509 using values_layout = cloning_ptr<array_wrapper>;
515 [[nodiscard]] const inner_value_type& dummy_inner_value() const;
516
522 [[nodiscard]] const_reference dummy_const_reference() const;
523
530 [[nodiscard]] static constexpr keys_layout create_keys_layout(arrow_proxy& proxy);
531
538 [[nodiscard]] static values_layout create_values_layout(arrow_proxy& proxy);
539
545 [[nodiscard]] constexpr arrow_proxy& get_arrow_proxy();
546
552 [[nodiscard]] constexpr const arrow_proxy& get_arrow_proxy() const;
553
555 arrow_proxy m_proxy;
557 keys_layout m_keys_layout;
559 values_layout p_values_layout;
560
562 };
563
572 template <class IT>
573 constexpr bool operator==(const dictionary_encoded_array<IT>& lhs, const dictionary_encoded_array<IT>& rhs);
574
575 /*******************************************
576 * dictionary_encoded_array implementation *
577 *******************************************/
578
579 template <std::integral IT>
581 : m_proxy(std::move(proxy))
582 , m_keys_layout(create_keys_layout(m_proxy))
583 , p_values_layout(create_values_layout(m_proxy))
584 {
585 SPARROW_ASSERT_TRUE(data_type_is_integer(m_proxy.data_type()));
586 }
587
588 template <std::integral IT>
590 : m_proxy(rhs.m_proxy)
591 , m_keys_layout(create_keys_layout(m_proxy))
592 , p_values_layout(create_values_layout(m_proxy))
593 {
594 }
595
596 template <std::integral IT>
598 {
599 if (this != &rhs)
600 {
601 m_proxy = rhs.m_proxy;
602 m_keys_layout = create_keys_layout(m_proxy);
603 p_values_layout = create_values_layout(m_proxy);
604 }
605 return *this;
606 }
607
608 template <std::integral IT>
610 : m_proxy(std::move(rhs.m_proxy))
611 , m_keys_layout(create_keys_layout(m_proxy))
612 , p_values_layout(create_values_layout(m_proxy))
613 {
614 }
615
616 template <std::integral IT>
618 {
619 if (this != &rhs)
620 {
621 using std::swap;
622 swap(m_proxy, rhs.m_proxy);
623 m_keys_layout = create_keys_layout(m_proxy);
624 p_values_layout = create_values_layout(m_proxy);
625 }
626 return *this;
627 }
628
629 template <std::integral IT>
630 template <validity_bitmap_input VBI, input_metadata_container METADATA_RANGE>
631 auto dictionary_encoded_array<IT>::create_proxy(
632 keys_buffer_type&& keys,
633 array&& values,
634 VBI&& validity_input,
635 std::optional<std::string_view> name,
636 std::optional<METADATA_RANGE> metadata
637 ) -> arrow_proxy
638 {
639 const auto size = keys.size();
640 validity_bitmap vbitmap = ensure_validity_bitmap(size, std::forward<VBI>(validity_input));
641 return create_proxy_impl(
642 std::forward<keys_buffer_type>(keys),
643 std::forward<array>(values),
644 std::make_optional<validity_bitmap>(std::move(vbitmap)),
645 std::move(name),
646 std::move(metadata)
647 );
648 }
649
650 template <std::integral IT>
651 template <validity_bitmap_input VBI, input_metadata_container METADATA_RANGE>
652 auto dictionary_encoded_array<IT>::create_proxy(
653 keys_buffer_type&& keys,
654 array&& values,
655 bool nullable,
656 std::optional<std::string_view> name,
657 std::optional<METADATA_RANGE> metadata
658 ) -> arrow_proxy
659 {
660 const auto size = keys.size();
661 return create_proxy_impl(
662 std::forward<keys_buffer_type>(keys),
663 std::forward<array>(values),
664 nullable ? std::make_optional<validity_bitmap>(nullptr, size) : std::nullopt,
665 std::move(name),
666 std::move(metadata)
667 );
668 }
669
670 template <std::integral IT>
671 template <input_metadata_container METADATA_RANGE>
672 [[nodiscard]] arrow_proxy dictionary_encoded_array<IT>::create_proxy_impl(
673 keys_buffer_type&& keys,
674 array&& values,
675 std::optional<validity_bitmap> validity,
676 std::optional<std::string_view> name,
677 std::optional<METADATA_RANGE> metadata
678 )
679 {
680 const auto size = keys.size();
681 auto [value_array, value_schema] = extract_arrow_structures(std::move(values));
682 static const repeat_view<bool> children_ownership{true, 0};
683
684 const std::optional<std::unordered_set<sparrow::ArrowFlag>>
685 flags = validity.has_value()
686 ? std::make_optional<std::unordered_set<sparrow::ArrowFlag>>({ArrowFlag::NULLABLE})
687 : std::nullopt;
688
689 // create arrow schema and array
692 std::move(name), // name
693 std::move(metadata), // metadata
694 flags, // flags
695 nullptr, // children
696 children_ownership, // children_ownership
697 new ArrowSchema(std::move(value_schema)), // dictionary
698 true // dictionary ownership
699 );
700
701 const size_t null_count = validity.has_value() ? validity->null_count() : 0;
702
703 std::vector<buffer<uint8_t>> buffers(2);
704 buffers[0] = validity.has_value() ? std::move(*validity).extract_storage()
705 : buffer<uint8_t>{nullptr, 0};
706 buffers[1] = std::move(keys).extract_storage();
707 // create arrow array
709 static_cast<std::int64_t>(size), // length
710 static_cast<std::int64_t>(null_count), // Null count
711 0, // offset
712 std::move(buffers),
713 nullptr, // children
714 children_ownership, // children_ownership
715 new ArrowArray(std::move(value_array)), // dictionary
716 true // dictionary ownership
717 );
718 return arrow_proxy(std::move(arr), std::move(schema));
719 }
720
721 template <std::integral IT>
722 template <std::ranges::input_range NULLABLE_KEY_RANGE, input_metadata_container METADATA_RANGE>
723 requires std::is_same_v<std::ranges::range_value_t<NULLABLE_KEY_RANGE>, nullable<IT>>
724 arrow_proxy dictionary_encoded_array<IT>::create_proxy(
725 NULLABLE_KEY_RANGE&& nullable_keys,
726 array&& values,
727 std::optional<std::string_view> name,
728 std::optional<METADATA_RANGE> metadata
729 )
730 {
731 auto keys = nullable_keys
732 | std::views::transform(
733 [](const auto& v)
734 {
735 return v.get();
736 }
737 );
738 auto is_non_null = nullable_keys
739 | std::views::transform(
740 [](const auto& v)
741 {
742 return v.has_value();
743 }
744 );
745 return create_proxy(
746 std::move(keys),
747 std::forward<array>(values),
748 std::move(is_non_null),
749 std::move(name),
750 std::move(metadata)
751 );
752 }
753
754 template <std::integral IT>
755 constexpr std::optional<std::string_view> dictionary_encoded_array<IT>::name() const
756 {
757 return m_proxy.name();
758 }
759
760 template <std::integral IT>
761 std::optional<key_value_view> dictionary_encoded_array<IT>::metadata() const
762 {
763 return m_proxy.metadata();
764 }
765
766 template <std::integral IT>
768 {
769 return m_proxy.length();
770 }
771
772 template <std::integral IT>
773 constexpr auto dictionary_encoded_array<IT>::empty() const -> bool
774 {
775 return size() == 0;
776 }
777
778 template <std::integral IT>
781 {
783 const auto index = m_keys_layout[i];
784
785 if (index.has_value())
786 {
787 SPARROW_ASSERT_TRUE(index.value() >= 0);
788 return array_element(*p_values_layout, static_cast<std::size_t>(index.value()));
789 }
790 else
791 {
792 return dummy_const_reference();
793 }
794 }
795
796 template <std::integral IT>
798 {
799 return iterator(functor_type(this), 0u);
800 }
801
802 template <std::integral IT>
804 {
805 return iterator(functor_type(this), size());
806 }
807
808 template <std::integral IT>
810 {
811 return cbegin();
812 }
813
814 template <std::integral IT>
816 {
817 return cend();
818 }
819
820 template <std::integral IT>
822 {
823 return const_iterator(const_functor_type(this), 0u);
824 }
825
826 template <std::integral IT>
828 {
829 return const_iterator(const_functor_type(this), size());
830 }
831
832 template <std::integral IT>
834 {
835 return reverse_iterator(end());
836 }
837
838 template <std::integral IT>
839 [[nodiscard]] constexpr auto dictionary_encoded_array<IT>::rend() -> reverse_iterator
840 {
841 return reverse_iterator(begin());
842 }
843
844 template <std::integral IT>
845 [[nodiscard]] constexpr auto dictionary_encoded_array<IT>::rbegin() const -> const_reverse_iterator
846 {
848 }
849
850 template <std::integral IT>
851 [[nodiscard]] constexpr auto dictionary_encoded_array<IT>::rend() const -> const_reverse_iterator
852 {
854 }
855
856 template <std::integral IT>
857 [[nodiscard]] constexpr auto dictionary_encoded_array<IT>::crbegin() const -> const_reverse_iterator
858 {
859 return rbegin();
860 }
861
862 template <std::integral IT>
863 [[nodiscard]] constexpr auto dictionary_encoded_array<IT>::crend() const -> const_reverse_iterator
864 {
865 return rend();
866 }
867
868 template <std::integral IT>
874
875 template <std::integral IT>
881
882 template <std::integral IT>
883 auto dictionary_encoded_array<IT>::dummy_inner_value() const -> const inner_value_type&
884 {
885 static const inner_value_type instance = array_default_element_value(*p_values_layout);
886 return instance;
887 }
888
889 template <std::integral IT>
891 {
892 SPARROW_ASSERT_TRUE(start <= end);
893 return self_type{get_arrow_proxy().slice(start, end)};
894 }
895
896 template <std::integral IT>
898 {
899 SPARROW_ASSERT_TRUE(start <= end);
900 return self_type{get_arrow_proxy().slice_view(start, end)};
901 }
902
903 /*template <std::integral IT>
904 auto dictionary_encoded_array<IT>::dummy_inner_const_reference() const -> inner_const_reference
905 {
906 static const inner_const_reference instance =
907 std::visit([](const auto& val) -> inner_const_reference { return val; }, dummy_inner_value());
908 return instance;
909 }*/
910
911 template <std::integral IT>
912 auto dictionary_encoded_array<IT>::dummy_const_reference() const -> const_reference
913 {
914 static const const_reference instance = std::visit(
915 [](const auto& val) -> const_reference
916 {
917 using inner_ref = typename arrow_traits<std::decay_t<decltype(val)>>::const_reference;
918 return const_reference{nullable<inner_ref>(inner_ref(val), false)};
919 },
920 dummy_inner_value()
921 );
922 return instance;
923 }
924
925 template <std::integral IT>
926 typename dictionary_encoded_array<IT>::values_layout
927 dictionary_encoded_array<IT>::create_values_layout(arrow_proxy& proxy)
928 {
929 const auto& dictionary = proxy.dictionary();
930 SPARROW_ASSERT_TRUE(dictionary);
931 arrow_proxy ar_dictionary{&(dictionary->array()), &(dictionary->schema())};
932 return array_factory(std::move(ar_dictionary));
933 }
934
935 template <std::integral IT>
936 constexpr auto dictionary_encoded_array<IT>::create_keys_layout(arrow_proxy& proxy) -> keys_layout
937 {
938 return keys_layout{arrow_proxy{&proxy.array(), &proxy.schema()}};
939 }
940
941 template <std::integral IT>
942 constexpr auto dictionary_encoded_array<IT>::get_arrow_proxy() -> arrow_proxy&
943 {
944 return m_proxy;
945 }
946
947 template <std::integral IT>
948 constexpr auto dictionary_encoded_array<IT>::get_arrow_proxy() const -> const arrow_proxy&
949 {
950 return m_proxy;
951 }
952
953 template <class IT>
955 {
956 return std::ranges::equal(lhs, rhs);
957 }
958}
959
960#if defined(__cpp_lib_format)
961template <std::integral IT>
962struct std::formatter<sparrow::dictionary_encoded_array<IT>>
963{
964 constexpr auto parse(std::format_parse_context& ctx)
965 {
966 return ctx.begin(); // Simple implementation
967 }
968
969 auto format(const sparrow::dictionary_encoded_array<IT>& ar, std::format_context& ctx) const
970 {
971 std::format_to(ctx.out(), "Dictionary [size={}] <", ar.size());
972 std::for_each(
973 ar.cbegin(),
974 std::prev(ar.cend()),
975 [&ctx](const auto& value)
976 {
977 std::format_to(ctx.out(), "{}, ", value);
978 }
979 );
980 std::format_to(ctx.out(), "{}>", ar.back());
981 return ctx.out();
982 }
983};
984
985template <std::integral IT>
986std::ostream& operator<<(std::ostream& os, const sparrow::dictionary_encoded_array<IT>& value)
987{
988 os << std::format("{}", value);
989 return os;
990}
991#endif
Dynamically typed array encapsulating an Arrow layout.
Definition array_api.hpp:39
Object that owns a piece of contiguous memory.
Definition buffer.hpp:112
Forward declaration of dictionary_encoded_array.
constexpr iterator begin()
Gets an iterator to the beginning of the array.
functor_index_iterator< const_functor_type > const_iterator
SPARROW_CONSTEXPR_CLANG_17 const_reference operator[](size_type i) const
Access operator for getting element at index.
constexpr self_type & operator=(const self_type &other)
Copy assignment operator.
constexpr const_reverse_iterator crbegin() const
Gets a constant reverse iterator to the beginning of the array.
constexpr self_type & operator=(self_type &&other)
Move assignment operator.
std::optional< key_value_view > metadata() const
Gets the metadata of the array.
constexpr self_type slice_view(size_type start, size_type end) const
Slices the array to keep only the elements between the given start and end.
layout_element_functor< self_type, true > functor_type
SPARROW_CONSTEXPR_CLANG_17 const_reference front() const
Gets a reference to the first element.
constexpr const_reverse_iterator rend() const
Gets a constant reverse iterator to the end of the array.
constexpr const_reverse_iterator crend() const
Gets a constant reverse iterator to the end of the array.
constexpr self_type slice(size_type start, size_type end) const
Slices the array to keep only the elements between the given start and end.
constexpr iterator end()
Gets an iterator to the end of the array.
constexpr const_iterator cend() const
Gets a constant iterator to the end of the array.
dictionary_encoded_array(arrow_proxy proxy)
Constructs a dictionary encoded array from an arrow proxy.
constexpr const_iterator cbegin() const
Gets a constant iterator to the beginning of the array.
layout_element_functor< self_type, true > const_functor_type
constexpr reverse_iterator rend()
Gets a reverse iterator to the end of the array.
dictionary_encoded_array(Args &&... args)
Constructs a dictionary encoded array with the given arguments.
constexpr const_iterator begin() const
Gets a constant iterator to the beginning of the array.
constexpr const_reverse_iterator rbegin() const
Gets a constant reverse iterator to the beginning of the array.
constexpr std::optional< std::string_view > name() const
Gets the name of the array.
constexpr bool empty() const
Checks if the array is empty.
constexpr dictionary_encoded_array(self_type &&other)
Move constructor.
constexpr size_type size() const
Gets the number of elements in the array.
constexpr const_iterator end() const
Gets a constant iterator to the end of the array.
SPARROW_CONSTEXPR_CLANG_17 const_reference back() const
Gets a reference to the last element.
constexpr reverse_iterator rbegin()
Gets a reverse iterator to the beginning of the array.
functor_index_iterator< functor_type > iterator
constexpr dictionary_encoded_array(const self_type &other)
Copy constructor.
std::reverse_iterator< const_iterator > const_reverse_iterator
Functor for accessing elements in a layout.
constexpr layout_element_functor(storage_type layout_)
Constructs a functor with the given layout.
std:: conditional_t< is_const, typename layout_type::const_reference, typename layout_type::reference > return_type
constexpr layout_element_functor()=default
Default constructor.
std::conditional_t< is_const, const layout_type *, layout_type > storage_type
constexpr return_type operator()(std::size_t i) const
Access operator for getting element at index.
A view that repeats a value a given number of times.
This buffer class is used as storage buffer for all sparrow arrays.
Concept for input containers that can provide metadata pairs.
Definition metadata.hpp:291
Concept defining valid input types for validity bitmap creation.
#define SPARROW_CONSTEXPR_CLANG_17
Definition config.hpp:63
#define SPARROW_ASSERT_TRUE(expr__)
#define SPARROW_ASSERT_FALSE(expr__)
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.
constexpr std::string_view data_type_to_format(data_type type)
SPARROW_API bool operator==(const array &lhs, const array &rhs)
Compares the content of two arrays.
constexpr bool is_dictionary_encoded_array_v
Checks whether T is a dictionary_encoded_array type.
SPARROW_API void swap(ArrowArray &lhs, ArrowArray &rhs)
Swaps the contents of the two ArrowArray objects.
SPARROW_API array_traits::inner_value_type array_default_element_value(const array_wrapper &ar)
std::pair< ArrowArray, ArrowSchema > extract_arrow_structures(A &&a)
Extracts the internal ArrowArray and ArrowSchema structures from the given array or typed layout.
Definition array.hpp:91
primitive_array_impl< T > primitive_array
Array of values of whose type has fixed binary size.
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 cloning_ptr< array_wrapper > array_factory(arrow_proxy proxy)
SPARROW_API array_traits::const_reference array_element(const array_wrapper &ar, std::size_t index)
validity_bitmap ensure_validity_bitmap(std::size_t size, R &&validity_input)
Ensures a validity bitmap of the specified size from various input types.
constexpr bool data_type_is_integer(data_type dt) noexcept
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
Provides compile-time information about Arrow data types.
static constexpr sparrow::data_type get() noexcept
Gets the data type for the dictionary keys.
Metafunction for retrieving the data_type of a typed array.
static constexpr bool get() noexcept
Returns true for dictionary_encoded_array types.
static constexpr bool get() noexcept