sparrow-ipc 0.2.0
Loading...
Searching...
No Matches
deserialize_time_related_arrays.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <optional>
4#include <span>
5#include <string>
6#include <string_view>
7#include <vector>
8
9#include <sparrow/arrow_interface/arrow_array_schema_proxy.hpp>
10#include <sparrow/date_array.hpp>
11#include <sparrow/time_array.hpp>
12#include <sparrow/timestamp_array.hpp>
13#include <sparrow/timestamp_without_timezone_array.hpp>
14
15#include "Message_generated.h"
17
18namespace sparrow_ipc
19{
20 template <typename T>
21 [[nodiscard]] sparrow::date_array<T> deserialize_non_owning_date_array(
22 const org::apache::arrow::flatbuf::RecordBatch& record_batch,
23 std::span<const uint8_t> body,
24 std::string_view name,
25 const std::optional<std::vector<sparrow::metadata_pair>>& metadata,
26 bool nullable,
27 size_t& buffer_index
28 )
29 {
31 record_batch,
32 body,
33 name,
34 metadata,
35 nullable,
36 buffer_index,
37 std::nullopt
38 );
39 }
40
41 template <typename T>
42 [[nodiscard]] sparrow::timestamp_array<T> deserialize_non_owning_timestamp_array(
43 const org::apache::arrow::flatbuf::RecordBatch& record_batch,
44 std::span<const uint8_t> body,
45 std::string_view name,
46 const std::optional<std::vector<sparrow::metadata_pair>>& metadata,
47 bool nullable,
48 size_t& buffer_index,
49 const std::string& timezone
50 )
51 {
52 std::string format = std::string(data_type_to_format(
53 sparrow::detail::get_data_type_from_array<sparrow::timestamp_array<T>>::get()
54 )) + timezone;
55
57 record_batch,
58 body,
59 name,
60 metadata,
61 nullable,
62 buffer_index,
63 std::move(format)
64 );
65 }
66
67 template <typename T>
68 [[nodiscard]] sparrow::timestamp_without_timezone_array<T> deserialize_non_owning_timestamp_without_timezone_array(
69 const org::apache::arrow::flatbuf::RecordBatch& record_batch,
70 std::span<const uint8_t> body,
71 std::string_view name,
72 const std::optional<std::vector<sparrow::metadata_pair>>& metadata,
73 bool nullable,
74 size_t& buffer_index
75 )
76 {
78 record_batch,
79 body,
80 name,
81 metadata,
82 nullable,
83 buffer_index,
84 std::nullopt
85 );
86 }
87
88 template <typename T>
89 [[nodiscard]] sparrow::time_array<T> deserialize_non_owning_time_array(
90 const org::apache::arrow::flatbuf::RecordBatch& record_batch,
91 std::span<const uint8_t> body,
92 std::string_view name,
93 const std::optional<std::vector<sparrow::metadata_pair>>& metadata,
94 bool nullable,
95 size_t& buffer_index
96 )
97 {
99 record_batch,
100 body,
101 name,
102 metadata,
103 nullable,
104 buffer_index,
105 std::nullopt
106 );
107 }
108}
ArrayType< T > deserialize_non_owning_simple_array(const org::apache::arrow::flatbuf::RecordBatch &record_batch, std::span< const uint8_t > body, std::string_view name, const std::optional< std::vector< sparrow::metadata_pair > > &metadata, bool nullable, size_t &buffer_index, std::optional< std::string > format_override=std::nullopt)
Generic implementation for deserializing non-owning arrays with simple layout.
sparrow::timestamp_without_timezone_array< T > deserialize_non_owning_timestamp_without_timezone_array(const org::apache::arrow::flatbuf::RecordBatch &record_batch, std::span< const uint8_t > body, std::string_view name, const std::optional< std::vector< sparrow::metadata_pair > > &metadata, bool nullable, size_t &buffer_index)
sparrow::time_array< T > deserialize_non_owning_time_array(const org::apache::arrow::flatbuf::RecordBatch &record_batch, std::span< const uint8_t > body, std::string_view name, const std::optional< std::vector< sparrow::metadata_pair > > &metadata, bool nullable, size_t &buffer_index)
sparrow::timestamp_array< T > deserialize_non_owning_timestamp_array(const org::apache::arrow::flatbuf::RecordBatch &record_batch, std::span< const uint8_t > body, std::string_view name, const std::optional< std::vector< sparrow::metadata_pair > > &metadata, bool nullable, size_t &buffer_index, const std::string &timezone)
sparrow::date_array< T > deserialize_non_owning_date_array(const org::apache::arrow::flatbuf::RecordBatch &record_batch, std::span< const uint8_t > body, std::string_view name, const std::optional< std::vector< sparrow::metadata_pair > > &metadata, bool nullable, size_t &buffer_index)