24 constexpr std::size_t sizeof_decimal =
sizeof(
typename T::integer_type);
25 std::string format_str =
"d:" + std::to_string(precision) +
"," + std::to_string(scale);
26 if constexpr (sizeof_decimal != 16)
29 format_str +=
"," + std::to_string(sizeof_decimal * 8);
42 const auto compression = context.
record_batch.compression();
43 std::vector<arrow_array_private_data::optionally_owned_buffer> buffers;
44 constexpr auto nb_buffers = 2;
45 buffers.reserve(nb_buffers);
59 std::visit([&buffers](
auto&& arg) {
60 using variant_type = std::decay_t<
decltype(arg)>;
61 if constexpr (std::is_same_v<variant_type, sparrow::buffer<std::uint8_t>>)
64 buffers.push_back(std::move(arg));
69 sparrow::buffer<std::uint8_t> aligned_buffer(arg.begin(), arg.end(), sparrow::buffer<std::uint8_t>::default_allocator());
70 buffers.push_back(std::move(aligned_buffer));
72 }, std::move(decompressed_data));
76 buffers.push_back(std::move(validity_buffer_span));
77 sparrow::buffer<std::uint8_t> data_buffer_copy(data_buffer_span.begin(), data_buffer_span.end(), sparrow::buffer<std::uint8_t>::default_allocator());
78 buffers.push_back(std::move(data_buffer_copy));
82 const auto null_count = std::visit(
83 [length = field_desc.
length](
const auto& arg) {
84 std::span<const uint8_t> span(arg.data(), arg.size());
85 return utils::get_bitmap_pointer_and_null_count(span, length).second;
99 sparrow::arrow_proxy ap{std::move(array), std::move(schema)};
100 return sparrow::decimal_array<T>(std::move(ap));
std::span< const uint8_t > get_buffer(const org::apache::arrow::flatbuf::RecordBatch &record_batch, std::span< const uint8_t > body, size_t &buffer_index)
Extracts a buffer from a RecordBatch's body.
std::variant< sparrow::buffer< std::uint8_t >, std::span< const std::uint8_t > > get_decompressed_buffer(std::span< const uint8_t > buffer_span, const org::apache::arrow::flatbuf::BodyCompression *compression)
Retrieves a decompressed buffer or a view of the original buffer.
ArrowSchema make_non_owning_arrow_schema(std::string_view format, std::string_view name, std::optional< M > metadata, std::optional< std::unordered_set< sparrow::ArrowFlag > > flags, size_t children_count, ArrowSchema **children, ArrowSchema *dictionary)
ArrowArray make_arrow_array(int64_t length, int64_t null_count, int64_t offset, size_t children_count, ArrowArray **children, ArrowArray *dictionary, Arg &&private_data_arg)
Encapsulates the context required for deserialization.
std::span< const uint8_t > body
const org::apache::arrow::flatbuf::RecordBatch & record_batch