sparrow 2.2.1
C++20 idiomatic APIs for the Apache Arrow Columnar Format
Loading...
Searching...
No Matches
decimal_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 <ranges>
18
28#include "sparrow/u8_buffer.hpp"
34
35namespace sparrow
36{
42 template <decimal_type T>
43 class decimal_array;
44
45 namespace copy_tracker
46 {
47 template <typename T>
49 std::string key()
50 {
51 return "decimal_array";
52 }
53 }
54
63
64 namespace detail
65 {
66 template <>
68 {
74 [[nodiscard]] static constexpr sparrow::data_type get()
75 {
77 }
78 };
79
81 template <>
83 {
89 [[nodiscard]] static constexpr sparrow::data_type get()
90 {
92 }
93 };
94
96 template <>
98 {
104 [[nodiscard]] static constexpr sparrow::data_type get()
105 {
107 }
108 };
109
111 template <>
113 {
119 [[nodiscard]] static constexpr sparrow::data_type get()
120 {
122 }
123 };
124
125 }
126
127 template <decimal_type T>
145
146
152 template <class T>
154
163 template <decimal_type T>
164 class decimal_array final : public mutable_array_bitmap_base<decimal_array<T>>
165 {
166 public:
167
170
172 using inner_value_type = typename inner_types::inner_value_type;
173 using inner_reference = typename inner_types::inner_reference;
174 using inner_const_reference = typename inner_types::inner_const_reference;
175
176 // the integral value type used to store the bits
177 using storage_type = typename T::integer_type;
178 static_assert(
179 sizeof(storage_type) == 4 || sizeof(storage_type) == 8 || sizeof(storage_type) == 16
180 || sizeof(storage_type) == 32,
181 "The storage type must be an integral type of size 4, 8, 16 or 32 bytes"
182 );
183
188
191
195
196 using value_iterator = typename inner_types::value_iterator;
197 using const_value_iterator = typename inner_types::const_value_iterator;
198
204 explicit decimal_array(arrow_proxy proxy);
205
212
220
226 decimal_array(decimal_array&& rhs) noexcept = default;
227
234 decimal_array& operator=(decimal_array&& rhs) noexcept = default;
235
242 template <class... Args>
244 explicit decimal_array(Args&&... args)
245 : decimal_array(create_proxy(std::forward<Args>(args)...))
246 {
247 }
248
255 [[nodiscard]] constexpr inner_reference value(size_type i);
256
263 [[nodiscard]] constexpr inner_const_reference value(size_type i) const;
264
265 private:
266
281 template <
282 std::ranges::input_range VALUE_RANGE,
283 validity_bitmap_input VALIDITY_RANGE,
284 input_metadata_container METADATA_RANGE = std::vector<metadata_pair>>
285 requires std::convertible_to<std::ranges::range_value_t<VALUE_RANGE>, typename T::integer_type>
286 [[nodiscard]] static auto create_proxy(
287 VALUE_RANGE&& range,
288 VALIDITY_RANGE&& bitmaps,
289 std::size_t precision,
290 int scale,
291 std::optional<std::string_view> name = std::nullopt,
292 std::optional<METADATA_RANGE> metadata = std::nullopt
293 ) -> arrow_proxy;
294
307 template <
308 std::ranges::input_range NULLABLE_VALUE_RANGE,
309 input_metadata_container METADATA_RANGE = std::vector<metadata_pair>>
310 requires std::is_same_v<std::ranges::range_value_t<NULLABLE_VALUE_RANGE>, nullable<typename T::integer_type>>
311 [[nodiscard]] static auto create_proxy(
312 NULLABLE_VALUE_RANGE&& range,
313 std::size_t precision,
314 int scale,
315 std::optional<std::string_view> name = std::nullopt,
316 std::optional<METADATA_RANGE> metadata = std::nullopt
317 ) -> arrow_proxy;
318
332 template <std::ranges::input_range VALUE_RANGE, input_metadata_container METADATA_RANGE = std::vector<metadata_pair>>
333 requires std::is_same_v<std::ranges::range_value_t<VALUE_RANGE>, typename T::integer_type>
334 [[nodiscard]] static auto create_proxy(
335 VALUE_RANGE&& range,
336 std::size_t precision,
337 int scale,
338 bool nullable = true,
339 std::optional<std::string_view> name = std::nullopt,
340 std::optional<METADATA_RANGE> metadata = std::nullopt
341 ) -> arrow_proxy;
342
356 template <validity_bitmap_input R, input_metadata_container METADATA_RANGE = std::vector<metadata_pair>>
357 [[nodiscard]] static auto create_proxy(
358 u8_buffer<storage_type>&& data_buffer,
359 R&& bitmaps,
360 std::size_t precision,
361 int scale,
362 std::optional<std::string_view> name = std::nullopt,
363 std::optional<METADATA_RANGE> metadata = std::nullopt
364 ) -> arrow_proxy;
365
378 template <input_metadata_container METADATA_RANGE = std::vector<metadata_pair>>
379 [[nodiscard]] static auto create_proxy(
380 u8_buffer<storage_type>&& data_buffer,
381 std::size_t precision,
382 int scale,
383 bool nullable = true,
384 std::optional<std::string_view> name = std::nullopt,
385 std::optional<METADATA_RANGE> metadata = std::nullopt
386 ) -> arrow_proxy;
387
400 template <input_metadata_container METADATA_RANGE = std::vector<metadata_pair>>
401 [[nodiscard]] static auto create_proxy_impl(
402 u8_buffer<storage_type>&& data_buffer,
403 std::size_t precision,
404 int scale,
405 std::optional<validity_bitmap> bitmap,
406 std::optional<std::string_view> name = std::nullopt,
407 std::optional<METADATA_RANGE> metadata = std::nullopt
408 ) -> arrow_proxy;
409
417 static constexpr std::string generate_format(std::size_t precision, int scale);
418
424 [[nodiscard]] constexpr value_iterator value_begin();
425
431 [[nodiscard]] constexpr value_iterator value_end();
432
438 [[nodiscard]] constexpr const_value_iterator value_cbegin() const;
439
445 [[nodiscard]] constexpr const_value_iterator value_cend() const;
446
453 constexpr void assign(const T& rhs, size_type index);
454
455 // Modifiers
456
463 constexpr void resize_values(size_t new_length, const inner_value_type& value);
464
473 constexpr value_iterator insert_value(const_value_iterator pos, inner_value_type value, size_t count);
474
484 template <std::input_iterator InputIt>
485 requires std::convertible_to<
486 typename std::iterator_traits<InputIt>::value_type,
488 constexpr value_iterator insert_values(const_value_iterator pos, InputIt first, InputIt last)
489 {
490 SPARROW_ASSERT_TRUE(value_cbegin() <= pos);
491 SPARROW_ASSERT_TRUE(pos <= value_cend());
492 const auto distance = std::distance(value_cbegin(), pos);
493 const auto offset = static_cast<difference_type>(this->get_arrow_proxy().offset());
494 auto data_buffer = get_data_buffer();
495 auto value_range = std::ranges::subrange(first, last);
496 auto storage_view = std::ranges::transform_view(
497 value_range,
498 [](const auto& v)
499 {
500 return v.storage();
501 }
502 );
503 const auto insertion_pos = data_buffer.cbegin() + distance + offset;
504 data_buffer.insert(insertion_pos, storage_view.begin(), storage_view.end());
505 return value_iterator(
507 static_cast<size_type>(distance)
508 );
509 }
510
518 constexpr value_iterator erase_values(const_value_iterator pos, size_t count);
519
525 [[nodiscard]] constexpr auto get_data_buffer()
526 {
527 auto& buffers = this->get_arrow_proxy().get_array_private_data()->buffers();
528 return make_buffer_adaptor<storage_type>(buffers[DATA_BUFFER_INDEX]);
529 }
530
532 static constexpr size_type DATA_BUFFER_INDEX = 1;
533 friend base_type;
538 friend class decimal_reference<self_type>;
539
541 std::size_t m_precision;
543 int m_scale;
544 };
545
546 /**********************************
547 * decimal_array implementation *
548 **********************************/
549
550 template <decimal_type T>
552 : base_type(std::move(proxy))
553 , m_precision(0)
554 , m_scale(0)
555 {
556 // parse the format string
557 const auto format = this->get_arrow_proxy().format();
558
559 // ensure that the format string starts with d:
560 if (format.size() < 2 || format[0] != 'd' || format[1] != ':')
561 {
562 throw std::runtime_error("Invalid format string for decimal array");
563 }
564
565 // substring staring aftet d:
566 const auto format_str = format.substr(2);
567
568 std::stringstream ss;
569 ss << format_str;
570 char c = 0;
571 ss >> m_precision >> c >> m_scale;
572
573 // check for failure
574 if (ss.fail())
575 {
576 throw std::runtime_error("Invalid format string for decimal array");
577 }
578 }
579
580 template <decimal_type T>
582 : base_type(rhs)
583 , m_precision(rhs.m_precision)
584 , m_scale(rhs.m_scale)
585 {
587 }
588
589 template <decimal_type T>
591 {
592 copy_tracker::increase("decimal_array");
594 m_precision = rhs.m_precision;
595 m_scale = rhs.m_scale;
596 return *this;
597 }
598
599 template <decimal_type T>
600 template <std::ranges::input_range VALUE_RANGE, validity_bitmap_input VALIDITY_RANGE, input_metadata_container METADATA_RANGE>
601 requires std::convertible_to<std::ranges::range_value_t<VALUE_RANGE>, typename T::integer_type>
602 arrow_proxy decimal_array<T>::create_proxy(
603 VALUE_RANGE&& range,
604 VALIDITY_RANGE&& bitmaps,
605 std::size_t precision,
606 int scale,
607 std::optional<std::string_view> name,
608 std::optional<METADATA_RANGE> metadata
609 )
610 {
611 u8_buffer<storage_type> u8_data_buffer(std::forward<VALUE_RANGE>(range));
612 const auto size = u8_data_buffer.size();
613 validity_bitmap bitmap = ensure_validity_bitmap(size, std::forward<VALIDITY_RANGE>(bitmaps));
614 return create_proxy_impl(
615 std::move(u8_data_buffer),
616 precision,
617 scale,
618 std::move(bitmap),
619 std::move(name),
620 std::move(metadata)
621 );
622 }
623
624 template <decimal_type T>
625 template <std::ranges::input_range NULLABLE_VALUE_RANGE, input_metadata_container METADATA_RANGE>
626 requires std::is_same_v<std::ranges::range_value_t<NULLABLE_VALUE_RANGE>, nullable<typename T::integer_type>>
627 arrow_proxy decimal_array<T>::create_proxy(
628 NULLABLE_VALUE_RANGE&& range,
629 std::size_t precision,
630 int scale,
631 std::optional<std::string_view> name,
632 std::optional<METADATA_RANGE> metadata
633 )
634 {
635 auto values = range
636 | std::views::transform(
637 [](const auto& v)
638 {
639 return v.get();
640 }
641 );
642 auto is_non_null = range
643 | std::views::transform(
644 [](const auto& v)
645 {
646 return v.has_value();
647 }
648 );
649 return create_proxy(values, is_non_null, precision, scale, std::move(name), std::move(metadata));
650 }
651
652 template <decimal_type T>
653 template <input_metadata_container METADATA_RANGE>
654 auto decimal_array<T>::create_proxy(
655 u8_buffer<storage_type>&& data_buffer,
656 std::size_t precision,
657 int scale,
658 bool nullable,
659 std::optional<std::string_view> name,
660 std::optional<METADATA_RANGE> metadata
661 ) -> arrow_proxy
662 {
663 const size_t size = data_buffer.size();
664 return create_proxy_impl(
665 std::move(data_buffer),
666 precision,
667 scale,
668 nullable ? std::make_optional<validity_bitmap>(nullptr, size, validity_bitmap::default_allocator())
669 : std::nullopt,
670 name,
671 metadata
672 );
673 }
674
675 template <decimal_type T>
676 template <std::ranges::input_range VALUE_RANGE, input_metadata_container METADATA_RANGE>
677 requires std::is_same_v<std::ranges::range_value_t<VALUE_RANGE>, typename T::integer_type>
678 arrow_proxy decimal_array<T>::create_proxy(
679 VALUE_RANGE&& range,
680 std::size_t precision,
681 int scale,
682 bool nullable,
683 std::optional<std::string_view> name,
684 std::optional<METADATA_RANGE> metadata
685 )
686 {
687 u8_buffer<storage_type> u8_data_buffer(std::forward<VALUE_RANGE>(range));
688 const auto size = u8_data_buffer.size();
689 return create_proxy_impl(
690 std::move(u8_data_buffer),
691 precision,
692 scale,
693 nullable ? std::make_optional<validity_bitmap>(nullptr, size, validity_bitmap::default_allocator())
694 : std::nullopt,
695 name,
696 metadata
697 );
698 }
699
700 template <decimal_type T>
701 template <validity_bitmap_input R, input_metadata_container METADATA_RANGE>
702 auto decimal_array<T>::create_proxy(
703 u8_buffer<storage_type>&& data_buffer,
704 R&& bitmap_input,
705 std::size_t precision,
706 int scale,
707 std::optional<std::string_view> name,
708 std::optional<METADATA_RANGE> metadata
709 ) -> arrow_proxy
710 {
711 const auto size = data_buffer.size();
712 validity_bitmap bitmap = ensure_validity_bitmap(size, std::forward<R>(bitmap_input));
713 return create_proxy_impl(
714 std::move(data_buffer),
715 precision,
716 scale,
717 std::move(bitmap),
718 std::move(name),
719 std::move(metadata)
720 );
721 }
722
723 template <decimal_type T>
724 template <input_metadata_container METADATA_RANGE>
725 [[nodiscard]] auto decimal_array<T>::create_proxy_impl(
726 u8_buffer<storage_type>&& data_buffer,
727 std::size_t precision,
728 int scale,
729 std::optional<validity_bitmap> bitmap,
730 std::optional<std::string_view> name,
731 std::optional<METADATA_RANGE> metadata
732 ) -> arrow_proxy
733 {
734 const std::optional<std::unordered_set<sparrow::ArrowFlag>>
735 flags = bitmap.has_value()
736 ? std::make_optional<std::unordered_set<sparrow::ArrowFlag>>({ArrowFlag::NULLABLE})
737 : std::nullopt;
738 static const repeat_view<bool> children_ownership{true, 0};
739 const auto size = data_buffer.size();
740 const size_t null_count = bitmap.has_value() ? bitmap->null_count() : 0;
741
742 // create arrow schema and array
743 ArrowSchema schema = make_arrow_schema(
744 generate_format(precision, scale),
745 name, // name
746 metadata, // metadata
747 flags, // flags
748 nullptr, // children
750 nullptr, // dictionary
751 true // dictionary ownership
752 );
753
754 std::vector<buffer<uint8_t>> buffers;
755 buffers.reserve(2);
756 buffers.emplace_back(
757 bitmap.has_value() ? std::move(*bitmap).extract_storage()
758 : buffer<uint8_t>{nullptr, 0, buffer<uint8_t>::default_allocator()}
759 );
760 buffers.emplace_back(std::move(data_buffer).extract_storage());
761
762 // create arrow array
763 ArrowArray arr = make_arrow_array(
764 static_cast<std::int64_t>(size), // lengths
765 static_cast<int64_t>(null_count),
766 0, // offset
767 std::move(buffers),
768 nullptr, // children
769 repeat_view<bool>(true, 0), // children_ownership
770 nullptr, // dictionary
771 true
772 );
773 return arrow_proxy(std::move(arr), std::move(schema));
774 }
775
776 template <decimal_type T>
778 {
779 SPARROW_ASSERT_TRUE(i < this->size());
780 return inner_reference(this, i);
781 }
782
783 template <decimal_type T>
785 {
786 SPARROW_ASSERT_TRUE(i < this->size());
787 const auto ptr = this->get_arrow_proxy().buffers()[DATA_BUFFER_INDEX].template data<const storage_type>();
788 return inner_const_reference(ptr[i], m_scale);
789 }
790
791 template <decimal_type T>
792 constexpr auto decimal_array<T>::value_begin() -> value_iterator
793 {
794 return value_iterator(detail::layout_value_functor<self_type, inner_reference>(this), 0);
795 }
796
797 template <decimal_type T>
798 constexpr auto decimal_array<T>::value_end() -> value_iterator
799 {
800 return value_iterator(detail::layout_value_functor<self_type, inner_reference>(this), this->size());
801 }
802
803 template <decimal_type T>
804 constexpr auto decimal_array<T>::value_cbegin() const -> const_value_iterator
805 {
806 return const_value_iterator(detail::layout_value_functor<const self_type, inner_value_type>(this), 0);
807 }
808
809 template <decimal_type T>
810 constexpr auto decimal_array<T>::value_cend() const -> const_value_iterator
811 {
812 return const_value_iterator(
814 this->size()
815 );
816 }
817
818 template <decimal_type T>
819 constexpr void decimal_array<T>::assign(const T& rhs, size_type index)
820 {
821 SPARROW_ASSERT_TRUE(index < this->size());
822 const auto ptr = this->get_arrow_proxy().buffers()[DATA_BUFFER_INDEX].template data<storage_type>();
823 const auto storage = rhs.storage();
824 // Scale the storage value to match the scale of the decimal type
825 const auto scaled_storage = storage
826 * static_cast<storage_type>(
827 static_cast<size_t>(std::pow(10, m_scale - rhs.scale()))
828 );
829 ptr[index] = scaled_storage;
830 }
831
832 template <decimal_type T>
833 constexpr std::string decimal_array<T>::generate_format(std::size_t precision, int scale)
834 {
835 constexpr std::size_t sizeof_decimal = sizeof(storage_type);
836 std::string format_str = "d:" + std::to_string(precision) + "," + std::to_string(scale);
837 if constexpr (sizeof_decimal != 16) // We don't need to specify the size for 128-bit
838 // decimals
839 {
840 format_str += "," + std::to_string(sizeof_decimal * 8);
841 }
842 return format_str;
843 }
844
845 template <decimal_type T>
846 constexpr void decimal_array<T>::resize_values(size_t new_length, const inner_value_type& value)
847 {
848 const size_t offset = static_cast<size_t>(this->get_arrow_proxy().offset());
849 const size_t new_size = new_length + offset;
850 auto data_buffer = get_data_buffer();
851 data_buffer.resize(new_size, value.storage());
852 }
853
854 template <decimal_type T>
855 constexpr auto
856 decimal_array<T>::insert_value(const_value_iterator pos, inner_value_type value, size_t count)
857 -> value_iterator
858 {
859 SPARROW_ASSERT_TRUE(value_cbegin() <= pos);
860 SPARROW_ASSERT_TRUE(pos <= value_cend());
861 const auto distance = std::distance(value_cbegin(), pos);
862 const auto offset = static_cast<difference_type>(this->get_arrow_proxy().offset());
863 auto data_buffer = get_data_buffer();
864 const auto insertion_pos = data_buffer.cbegin() + distance + offset;
865 data_buffer.insert(insertion_pos, count, value.storage());
866 return value_iterator(
868 static_cast<size_type>(distance)
869 );
870 }
871
872 template <decimal_type T>
873 constexpr auto decimal_array<T>::erase_values(const_value_iterator pos, size_t count) -> value_iterator
874 {
875 SPARROW_ASSERT_TRUE(value_cbegin() <= pos);
876 SPARROW_ASSERT_TRUE(pos < value_cend());
877 const auto distance = std::distance(value_cbegin(), pos);
878 const auto offset = static_cast<difference_type>(this->get_arrow_proxy().offset());
879 auto data_buffer = get_data_buffer();
880 const auto erase_begin = data_buffer.cbegin() + distance + offset;
881 const auto erase_end = erase_begin + static_cast<difference_type>(count);
882 data_buffer.erase(erase_begin, erase_end);
883 return value_iterator(
885 static_cast<size_type>(distance)
886 );
887 }
888}
typename base_type::const_bitmap_range const_bitmap_range
typename base_type::iterator_tag iterator_tag
typename base_type::const_bitmap_iterator const_bitmap_iterator
constexpr array_bitmap_base_impl & operator=(const array_bitmap_base_impl &)
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 size_type size() const noexcept(!SPARROW_CONTRACTS_THROW_ON_FAILURE)
Returns the number of elements that can be held in currently allocated storage.
Object that owns a piece of contiguous memory.
Definition buffer.hpp:131
Array implementation for decimal types.
nullable< inner_const_reference, bitmap_const_reference > const_reference
typename base_type::difference_type difference_type
typename base_type::bitmap_const_reference bitmap_const_reference
array_inner_types< self_type > inner_types
decimal_array(arrow_proxy proxy)
Constructs a decimal array from an arrow proxy.
typename inner_types::const_value_iterator const_value_iterator
typename base_type::const_bitmap_iterator const_bitmap_iterator
typename base_type::bitmap_type bitmap_type
typename base_type::const_bitmap_range const_bitmap_range
decimal_array(const decimal_array &rhs)
Copy constructor.
decimal_array & operator=(const decimal_array &rhs)
Copy assignment operator.
typename inner_types::inner_reference inner_reference
constexpr inner_const_reference value(size_type i) const
Gets a constant reference to the value at the specified index.
typename inner_types::inner_const_reference inner_const_reference
mutable_array_bitmap_base< self_type > base_type
typename inner_types::inner_value_type inner_value_type
typename base_type::iterator_tag iterator_tag
decimal_array(Args &&... args)
Constructs a decimal array with the given arguments.
decimal_array(decimal_array &&rhs) noexcept=default
Move constructor.
decimal_array & operator=(decimal_array &&rhs) noexcept=default
Move assignment operator.
constexpr inner_reference value(size_type i)
Gets a mutable reference to the value at the specified index.
typename inner_types::value_iterator value_iterator
storage_type extract_storage() noexcept
Extracts the underlying storage (move operation).
constexpr size_type null_count() const noexcept
Returns the number of bits set to false (null/invalid).
typename storage_type::default_allocator default_allocator
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_ASSERT_TRUE(expr__)
SPARROW_API void increase(const std::string &key)
SPARROW_API int count(const std::string &key, int disabled_value=0)
std::string key()
Definition buffer.hpp:49
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
constexpr bool is_decimal_array_v
Type trait to check if a type is a decimal array.
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.
decimal_array< decimal< int128_t > > decimal_128_array
Type alias for 128-bit decimal array.
decimal_array< decimal< int32_t > > decimal_32_array
Type alias for 32-bit decimal array.
decimal_array< decimal< int64_t > > decimal_64_array
Type alias for 64-bit decimal array.
decimal_array< decimal< int256_t > > decimal_256_array
Type alias for 256-bit decimal 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.
auto make_buffer_adaptor(FromBufferRef &buf)
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.
Extensions to the C++ standard library.
functor_index_iterator< detail::layout_value_functor< array_type, inner_reference > > value_iterator
decimal_reference< array_type > inner_reference
functor_index_iterator< detail::layout_value_functor< const array_type, inner_value_type > > const_value_iterator
bitmap_type::const_reference bitmap_const_reference
nullable< inner_const_reference, bitmap_const_reference > const_reference
Base class for array_inner_types specializations.
Traits class that must be specialized by array implementations.
static constexpr sparrow::data_type get()
Gets the data type for 128-bit decimal.
static constexpr sparrow::data_type get()
Gets the data type for 256-bit decimal.
static constexpr sparrow::data_type get()
Gets the data type for 32-bit decimal.
static constexpr sparrow::data_type get()
Gets the data type for 64-bit decimal.
Metafunction for retrieving the data_type of a typed array.