Skip to content

Commit 80bccfb

Browse files
committed
wip
1 parent 713198e commit 80bccfb

File tree

7 files changed

+425
-4
lines changed

7 files changed

+425
-4
lines changed

include/sparrow_ipc/deserialize_fixedsizebinary_array.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ namespace sparrow_ipc
1515
std::span<const uint8_t> body,
1616
std::string_view name,
1717
const std::optional<std::vector<sparrow::metadata_pair>>& metadata,
18+
bool nullable,
1819
size_t& buffer_index,
1920
int32_t byte_width
2021
);

include/sparrow_ipc/deserialize_primitive_array.hpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#pragma once
22

33
#include <optional>
4+
#include <unordered_set>
45
#include <vector>
56

67
#include <sparrow/arrow_interface/arrow_array_schema_proxy.hpp>
@@ -19,17 +20,26 @@ namespace sparrow_ipc
1920
std::span<const uint8_t> body,
2021
std::string_view name,
2122
const std::optional<std::vector<sparrow::metadata_pair>>& metadata,
23+
bool nullable,
2224
size_t& buffer_index
2325
)
2426
{
2527
const std::string_view format = data_type_to_format(
2628
sparrow::detail::get_data_type_from_array<sparrow::primitive_array<T>>::get()
2729
);
30+
31+
// Set up flags based on nullable
32+
std::optional<std::unordered_set<sparrow::ArrowFlag>> flags;
33+
if (nullable)
34+
{
35+
flags = std::unordered_set<sparrow::ArrowFlag>{sparrow::ArrowFlag::NULLABLE};
36+
}
37+
2838
ArrowSchema schema = make_non_owning_arrow_schema(
2939
format,
3040
name.data(),
3141
metadata,
32-
std::nullopt,
42+
flags,
3343
0,
3444
nullptr,
3545
nullptr

include/sparrow_ipc/deserialize_variable_size_binary_array.hpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#pragma once
22

33
#include <span>
4+
#include <unordered_set>
45

56
#include <sparrow/arrow_interface/arrow_array_schema_proxy.hpp>
67
#include <sparrow/variable_size_binary_array.hpp>
@@ -18,15 +19,24 @@ namespace sparrow_ipc
1819
std::span<const uint8_t> body,
1920
std::string_view name,
2021
const std::optional<std::vector<sparrow::metadata_pair>>& metadata,
22+
bool nullable,
2123
size_t& buffer_index
2224
)
2325
{
2426
const std::string_view format = data_type_to_format(sparrow::detail::get_data_type_from_array<T>::get());
27+
28+
// Set up flags based on nullable
29+
std::optional<std::unordered_set<sparrow::ArrowFlag>> flags;
30+
if (nullable)
31+
{
32+
flags = std::unordered_set<sparrow::ArrowFlag>{sparrow::ArrowFlag::NULLABLE};
33+
}
34+
2535
ArrowSchema schema = make_non_owning_arrow_schema(
2636
format,
2737
name.data(),
2838
metadata,
29-
std::nullopt,
39+
flags,
3040
0,
3141
nullptr,
3242
nullptr

0 commit comments

Comments
 (0)