sparrow 2.2.1
C++20 idiomatic APIs for the Apache Arrow Columnar Format
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"
36
37namespace sparrow
38{
45 template <class Layout, bool is_const>
47 {
48 public:
49
50 using layout_type = Layout;
51 using storage_type = std::conditional_t<is_const, const layout_type*, layout_type>;
52 using return_type = std::
53 conditional_t<is_const, typename layout_type::const_reference, typename layout_type::reference>;
54
58 constexpr layout_element_functor() = default;
59
65 constexpr explicit layout_element_functor(storage_type layout_)
66 : p_layout(layout_)
67 {
68 }
69
76 [[nodiscard]] constexpr return_type operator()(std::size_t i) const
77 {
78 return p_layout->operator[](i);
79 }
80
81 private:
82
84 storage_type p_layout;
85 };
86
92 template <std::integral IT>
93 class dictionary_encoded_array;
94
95 namespace copy_tracker
96 {
97 template <typename T>
99 std::string key()
100 {
101 return "dictionary_encoded_array";
102 }
103 }
104
105 namespace detail
106 {
107 template <std::integral IT>
109 {
115 [[nodiscard]] static constexpr sparrow::data_type get() noexcept
116 {
118 }
119 };
120
126 template <std::integral IT>
128 {
134 [[nodiscard]] static constexpr bool get() noexcept
135 {
136 return true;
137 }
138 };
139 }
140
146 template <class T>
148
159 template <std::integral IT>
161 {
162 public:
163
165 using size_type = std::size_t;
166 using difference_type = std::ptrdiff_t;
167
169
173
176
178 using reverse_iterator = std::reverse_iterator<iterator>;
180 using const_reverse_iterator = std::reverse_iterator<const_iterator>;
181
183
190
196 constexpr dictionary_encoded_array(const self_type& other);
197
204 constexpr self_type& operator=(const self_type& other);
205
212
219 constexpr self_type& operator=(self_type&& other);
220
226 [[nodiscard]] constexpr std::optional<std::string_view> name() const;
227
233 [[nodiscard]] std::optional<key_value_view> metadata() const;
234
240 [[nodiscard]] constexpr size_type size() const;
241
247 [[nodiscard]] constexpr bool empty() const;
248
256
262 [[nodiscard]] constexpr iterator begin();
263
269 [[nodiscard]] constexpr iterator end();
270
276 [[nodiscard]] constexpr const_iterator begin() const;
277
283 [[nodiscard]] constexpr const_iterator end() const;
284
290 [[nodiscard]] constexpr const_iterator cbegin() const;
291
297 [[nodiscard]] constexpr const_iterator cend() const;
298
304 [[nodiscard]] constexpr reverse_iterator rbegin();
305
311 [[nodiscard]] constexpr reverse_iterator rend();
312
318 [[nodiscard]] constexpr const_reverse_iterator rbegin() const;
319
325 [[nodiscard]] constexpr const_reverse_iterator rend() const;
326
332 [[nodiscard]] constexpr const_reverse_iterator crbegin() const;
333
339 [[nodiscard]] constexpr const_reverse_iterator crend() const;
340
347
354
361 template <class... Args>
363 explicit dictionary_encoded_array(Args&&... args)
364 : dictionary_encoded_array(create_proxy(std::forward<Args>(args)...))
365 {
366 }
367
377 [[nodiscard]] constexpr self_type slice(size_type start, size_type end) const;
378
388 [[nodiscard]] constexpr self_type slice_view(size_type start, size_type end) const;
389
390 private:
391
404 template <
406 input_metadata_container METADATA_RANGE = std::vector<metadata_pair>>
407 [[nodiscard]] static auto create_proxy(
408 keys_buffer_type&& keys,
409 array&& values,
410 R&& bitmaps,
411 std::optional<std::string_view> name = std::nullopt,
412 std::optional<METADATA_RANGE> metadata = std::nullopt
413 ) -> arrow_proxy;
414
427 template <
429 input_metadata_container METADATA_RANGE = std::vector<metadata_pair>>
430 [[nodiscard]] static auto create_proxy(
431 keys_buffer_type&& keys,
432 array&& values,
433 bool nullable = true,
434 std::optional<std::string_view> name = std::nullopt,
435 std::optional<METADATA_RANGE> metadata = std::nullopt
436 ) -> arrow_proxy;
437
449 template <input_metadata_container METADATA_RANGE = std::vector<metadata_pair>>
450 [[nodiscard]] static auto create_proxy_impl(
451 keys_buffer_type&& keys,
452 array&& values,
453 std::optional<validity_bitmap> validity = std::nullopt,
454 std::optional<std::string_view> name = std::nullopt,
455 std::optional<METADATA_RANGE> metadata = std::nullopt
456 ) -> arrow_proxy;
457
471 template <
472 std::ranges::input_range KEY_RANGE,
474 input_metadata_container METADATA_RANGE = std::vector<metadata_pair>>
475 requires(
476 !std::same_as<KEY_RANGE, keys_buffer_type>
477 and std::same_as<IT, std::ranges::range_value_t<KEY_RANGE>>
478 )
479 [[nodiscard]] static arrow_proxy create_proxy(
480 KEY_RANGE&& keys,
481 array&& values,
483 std::optional<std::string_view> name = std::nullopt,
484 std::optional<METADATA_RANGE> metadata = std::nullopt
485 )
486 {
487 keys_buffer_type keys_buffer(std::forward<KEY_RANGE>(keys));
488 return create_proxy(
489 std::move(keys_buffer),
490 std::forward<array>(values),
491 std::forward<R>(bitmaps),
492 std::move(name),
493 std::move(metadata)
494 );
495 }
496
508 template <
509 std::ranges::input_range NULLABLE_KEY_RANGE,
510 input_metadata_container METADATA_RANGE = std::vector<metadata_pair>>
511 requires std::is_same_v<std::ranges::range_value_t<NULLABLE_KEY_RANGE>, nullable<IT>>
512 static arrow_proxy create_proxy(
513 NULLABLE_KEY_RANGE&& nullable_keys,
514 array&& values,
515 std::optional<std::string_view> name = std::nullopt,
516 std::optional<METADATA_RANGE> metadata = std::nullopt
517 );
518
519 using keys_layout = primitive_array<IT>;
520 using values_layout = cloning_ptr<array_wrapper>;
526 [[nodiscard]] const inner_value_type& dummy_inner_value() const;
527
533 [[nodiscard]] const_reference dummy_const_reference() const;
534
541 [[nodiscard]] static constexpr keys_layout create_keys_layout(arrow_proxy& proxy);
542
549 [[nodiscard]] static values_layout create_values_layout(arrow_proxy& proxy);
550
556 [[nodiscard]] constexpr arrow_proxy& get_arrow_proxy();
557
563 [[nodiscard]] constexpr const arrow_proxy& get_arrow_proxy() const;
564
566 arrow_proxy m_proxy;
568 keys_layout m_keys_layout;
570 values_layout p_values_layout;
571
573 };
574
583 template <class IT>
584 constexpr bool operator==(const dictionary_encoded_array<IT>& lhs, const dictionary_encoded_array<IT>& rhs);
585
586 /*******************************************
587 * dictionary_encoded_array implementation *
588 *******************************************/
589
590 template <std::integral IT>
592 : m_proxy(std::move(proxy))
593 , m_keys_layout(create_keys_layout(m_proxy))
594 , p_values_layout(create_values_layout(m_proxy))
595 {
596 SPARROW_ASSERT_TRUE(data_type_is_integer(m_proxy.data_type()));
597 }
598
599 template <std::integral IT>
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 {
606 }
607
608 template <std::integral IT>
610 {
612 if (this != &rhs)
613 {
614 m_proxy = rhs.m_proxy;
615 m_keys_layout = create_keys_layout(m_proxy);
616 p_values_layout = create_values_layout(m_proxy);
617 }
618 return *this;
619 }
620
621 template <std::integral IT>
623 : m_proxy(std::move(rhs.m_proxy))
624 , m_keys_layout(create_keys_layout(m_proxy))
625 , p_values_layout(create_values_layout(m_proxy))
626 {
627 }
628
629 template <std::integral IT>
631 {
632 if (this != &rhs)
633 {
634 using std::swap;
635 swap(m_proxy, rhs.m_proxy);
636 m_keys_layout = create_keys_layout(m_proxy);
637 p_values_layout = create_values_layout(m_proxy);
638 }
639 return *this;
640 }
641
642 template <std::integral IT>
643 template <validity_bitmap_input VBI, input_metadata_container METADATA_RANGE>
644 auto dictionary_encoded_array<IT>::create_proxy(
645 keys_buffer_type&& keys,
646 array&& values,
647 VBI&& validity_input,
648 std::optional<std::string_view> name,
649 std::optional<METADATA_RANGE> metadata
650 ) -> arrow_proxy
651 {
652 const auto size = keys.size();
653 validity_bitmap vbitmap = ensure_validity_bitmap(size, std::forward<VBI>(validity_input));
654 return create_proxy_impl(
655 std::forward<keys_buffer_type>(keys),
656 std::forward<array>(values),
657 std::make_optional<validity_bitmap>(std::move(vbitmap)),
658 std::move(name),
659 std::move(metadata)
660 );
661 }
662
663 template <std::integral IT>
664 template <validity_bitmap_input VBI, input_metadata_container METADATA_RANGE>
665 auto dictionary_encoded_array<IT>::create_proxy(
666 keys_buffer_type&& keys,
667 array&& values,
668 bool nullable,
669 std::optional<std::string_view> name,
670 std::optional<METADATA_RANGE> metadata
671 ) -> arrow_proxy
672 {
673 const auto size = keys.size();
674 return create_proxy_impl(
675 std::forward<keys_buffer_type>(keys),
676 std::forward<array>(values),
677 nullable ? std::make_optional<validity_bitmap>(nullptr, size, validity_bitmap::default_allocator())
678 : std::nullopt,
679 std::move(name),
680 std::move(metadata)
681 );
682 }
683
684 template <std::integral IT>
685 template <input_metadata_container METADATA_RANGE>
686 [[nodiscard]] arrow_proxy dictionary_encoded_array<IT>::create_proxy_impl(
687 keys_buffer_type&& keys,
688 array&& values,
689 std::optional<validity_bitmap> validity,
690 std::optional<std::string_view> name,
691 std::optional<METADATA_RANGE> metadata
692 )
693 {
694 const auto size = keys.size();
695 auto [value_array, value_schema] = extract_arrow_structures(std::move(values));
696 static const repeat_view<bool> children_ownership{true, 0};
697
698 const std::optional<std::unordered_set<sparrow::ArrowFlag>>
699 flags = validity.has_value()
700 ? std::make_optional<std::unordered_set<sparrow::ArrowFlag>>({ArrowFlag::NULLABLE})
701 : std::nullopt;
702
703 // create arrow schema and array
706 std::move(name), // name
707 std::move(metadata), // metadata
708 flags, // flags
709 nullptr, // children
710 children_ownership, // children_ownership
711 new ArrowSchema(std::move(value_schema)), // dictionary
712 true // dictionary ownership
713 );
714
715 const size_t null_count = validity.has_value() ? validity->null_count() : 0;
716
717 std::vector<buffer<uint8_t>> buffers;
718 buffers.reserve(2);
719 buffers.emplace_back(
720 validity.has_value() ? std::move(*validity).extract_storage()
721 : buffer<uint8_t>{nullptr, 0, buffer<uint8_t>::default_allocator()}
722 );
723 buffers.emplace_back(std::move(keys).extract_storage());
724 // create arrow array
726 static_cast<std::int64_t>(size), // length
727 static_cast<std::int64_t>(null_count), // Null count
728 0, // offset
729 std::move(buffers),
730 nullptr, // children
731 children_ownership, // children_ownership
732 new ArrowArray(std::move(value_array)), // dictionary
733 true // dictionary ownership
734 );
735 return arrow_proxy(std::move(arr), std::move(schema));
736 }
737
738 template <std::integral IT>
739 template <std::ranges::input_range NULLABLE_KEY_RANGE, input_metadata_container METADATA_RANGE>
740 requires std::is_same_v<std::ranges::range_value_t<NULLABLE_KEY_RANGE>, nullable<IT>>
741 arrow_proxy dictionary_encoded_array<IT>::create_proxy(
742 NULLABLE_KEY_RANGE&& nullable_keys,
743 array&& values,
744 std::optional<std::string_view> name,
745 std::optional<METADATA_RANGE> metadata
746 )
747 {
748 auto keys = nullable_keys
749 | std::views::transform(
750 [](const auto& v)
751 {
752 return v.get();
753 }
754 );
755 auto is_non_null = nullable_keys
756 | std::views::transform(
757 [](const auto& v)
758 {
759 return v.has_value();
760 }
761 );
762 return create_proxy(
763 std::move(keys),
764 std::forward<array>(values),
765 std::move(is_non_null),
766 std::move(name),
767 std::move(metadata)
768 );
769 }
770
771 template <std::integral IT>
772 constexpr std::optional<std::string_view> dictionary_encoded_array<IT>::name() const
773 {
774 return m_proxy.name();
775 }
776
777 template <std::integral IT>
778 std::optional<key_value_view> dictionary_encoded_array<IT>::metadata() const
779 {
780 return m_proxy.metadata();
781 }
782
783 template <std::integral IT>
785 {
786 return m_proxy.length();
787 }
788
789 template <std::integral IT>
790 constexpr auto dictionary_encoded_array<IT>::empty() const -> bool
791 {
792 return size() == 0;
793 }
794
795 template <std::integral IT>
797 {
799 const auto index = m_keys_layout[i];
800
801 if (index.has_value())
802 {
803 SPARROW_ASSERT_TRUE(index.value() >= 0);
804 return array_element(*p_values_layout, static_cast<std::size_t>(index.value()));
805 }
806 else
807 {
808 return dummy_const_reference();
809 }
810 }
811
812 template <std::integral IT>
814 {
815 return iterator(functor_type(this), 0u);
816 }
817
818 template <std::integral IT>
820 {
821 return iterator(functor_type(this), size());
822 }
823
824 template <std::integral IT>
826 {
827 return cbegin();
828 }
829
830 template <std::integral IT>
832 {
833 return cend();
834 }
835
836 template <std::integral IT>
838 {
839 return const_iterator(const_functor_type(this), 0u);
840 }
841
842 template <std::integral IT>
844 {
845 return const_iterator(const_functor_type(this), size());
846 }
847
848 template <std::integral IT>
850 {
851 return reverse_iterator(end());
852 }
853
854 template <std::integral IT>
855 [[nodiscard]] constexpr auto dictionary_encoded_array<IT>::rend() -> reverse_iterator
856 {
857 return reverse_iterator(begin());
858 }
859
860 template <std::integral IT>
861 [[nodiscard]] constexpr auto dictionary_encoded_array<IT>::rbegin() const -> const_reverse_iterator
862 {
864 }
865
866 template <std::integral IT>
867 [[nodiscard]] constexpr auto dictionary_encoded_array<IT>::rend() const -> const_reverse_iterator
868 {
870 }
871
872 template <std::integral IT>
873 [[nodiscard]] constexpr auto dictionary_encoded_array<IT>::crbegin() const -> const_reverse_iterator
874 {
875 return rbegin();
876 }
877
878 template <std::integral IT>
879 [[nodiscard]] constexpr auto dictionary_encoded_array<IT>::crend() const -> const_reverse_iterator
880 {
881 return rend();
882 }
883
884 template <std::integral IT>
890
891 template <std::integral IT>
897
898 template <std::integral IT>
899 auto dictionary_encoded_array<IT>::dummy_inner_value() const -> const inner_value_type&
900 {
901 static const inner_value_type instance = array_default_element_value(*p_values_layout);
902 return instance;
903 }
904
905 template <std::integral IT>
907 {
908 SPARROW_ASSERT_TRUE(start <= end);
909 return self_type{get_arrow_proxy().slice(start, end)};
910 }
911
912 template <std::integral IT>
914 {
915 SPARROW_ASSERT_TRUE(start <= end);
916 return self_type{get_arrow_proxy().slice_view(start, end)};
917 }
918
919 /*template <std::integral IT>
920 auto dictionary_encoded_array<IT>::dummy_inner_const_reference() const -> inner_const_reference
921 {
922 static const inner_const_reference instance =
923 std::visit([](const auto& val) -> inner_const_reference { return val; }, dummy_inner_value());
924 return instance;
925 }*/
926
927 template <std::integral IT>
928 auto dictionary_encoded_array<IT>::dummy_const_reference() const -> const_reference
929 {
930 static const const_reference instance = std::visit(
931 [](const auto& val) -> const_reference
932 {
933 using inner_ref = typename arrow_traits<std::decay_t<decltype(val)>>::const_reference;
934 return const_reference{nullable<inner_ref>(inner_ref(val), false)};
935 },
936 dummy_inner_value()
937 );
938 return instance;
939 }
940
941 template <std::integral IT>
942 typename dictionary_encoded_array<IT>::values_layout
943 dictionary_encoded_array<IT>::create_values_layout(arrow_proxy& proxy)
944 {
945 const auto& dictionary = proxy.dictionary();
946 SPARROW_ASSERT_TRUE(dictionary);
947 arrow_proxy ar_dictionary{&(dictionary->array()), &(dictionary->schema())};
948 return array_factory(std::move(ar_dictionary));
949 }
950
951 template <std::integral IT>
952 constexpr auto dictionary_encoded_array<IT>::create_keys_layout(arrow_proxy& proxy) -> keys_layout
953 {
954 return keys_layout{arrow_proxy{&proxy.array(), &proxy.schema()}};
955 }
956
957 template <std::integral IT>
958 constexpr auto dictionary_encoded_array<IT>::get_arrow_proxy() -> arrow_proxy&
959 {
960 return m_proxy;
961 }
962
963 template <std::integral IT>
964 constexpr auto dictionary_encoded_array<IT>::get_arrow_proxy() const -> const arrow_proxy&
965 {
966 return m_proxy;
967 }
968
969 template <class IT>
971 {
972 return std::ranges::equal(lhs, rhs);
973 }
974}
975
976#if defined(__cpp_lib_format)
977template <std::integral IT>
978struct std::formatter<sparrow::dictionary_encoded_array<IT>>
979{
980 constexpr auto parse(std::format_parse_context& ctx)
981 {
982 return ctx.begin(); // Simple implementation
983 }
984
985 auto format(const sparrow::dictionary_encoded_array<IT>& ar, std::format_context& ctx) const
986 {
987 std::format_to(ctx.out(), "Dictionary [size={}] <", ar.size());
988 std::for_each(
989 ar.cbegin(),
990 std::prev(ar.cend()),
991 [&ctx](const auto& value)
992 {
993 std::format_to(ctx.out(), "{}, ", value);
994 }
995 );
996 std::format_to(ctx.out(), "{}>", ar.back());
997 return ctx.out();
998 }
999};
1000
1001namespace sparrow
1002{
1003 template <std::integral IT>
1004 std::ostream& operator<<(std::ostream& os, const dictionary_encoded_array<IT>& value)
1005 {
1006 os << std::format("{}", value);
1007 return os;
1008 }
1009}
1010
1011#endif
Dynamically typed array encapsulating an Arrow layout.
Definition array_api.hpp:43
Object that owns a piece of contiguous memory.
Definition buffer.hpp:131
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 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.
SPARROW_CONSTEXPR_CLANG const_reference back() const
Gets a reference to the last element.
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
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.
SPARROW_CONSTEXPR_CLANG const_reference front() const
Gets a reference to the first element.
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.
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
typename storage_type::default_allocator default_allocator
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:332
Concept defining valid input types for validity bitmap creation.
#define SPARROW_CONSTEXPR_CLANG
Definition config.hpp:64
#define SPARROW_ASSERT_TRUE(expr__)
#define SPARROW_ASSERT_FALSE(expr__)
SPARROW_API void increase(const std::string &key)
std::string key()
Definition buffer.hpp:49
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
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 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:110
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.
std::ostream & operator<<(std::ostream &os, const nullval_t &)
primitive_array_impl< T, Ext, T2 > primitive_array
Array of values of whose type has fixed binary size.
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)
SPARROW_API void swap(ArrowArray &lhs, ArrowArray &rhs) noexcept
Swaps the contents of the two ArrowArray objects.
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.
Extensions to the C++ standard library.
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