@@ -98,6 +98,7 @@ O2_ARROW_STL_CONVERSION(long unsigned, UInt64Type)
9898O2_ARROW_STL_CONVERSION (float , FloatType)
9999O2_ARROW_STL_CONVERSION (double , DoubleType)
100100O2_ARROW_STL_CONVERSION (std::string, StringType)
101+ O2_ARROW_STL_CONVERSION (std::span<std::byte>, BinaryViewType)
101102} // namespace detail
102103
103104void addLabelToSchema (std::shared_ptr<arrow::Schema>& schema, const char * label);
@@ -274,6 +275,29 @@ struct BuilderMaker<bool> {
274275 }
275276};
276277
278+ template <>
279+ struct BuilderMaker <std::span<std::byte>> {
280+ using FillType = std::span<std::byte>;
281+ using STLValueType = std::span<std::byte>;
282+ using ArrowType = typename detail::ConversionTraits<std::span<std::byte>>::ArrowType;
283+ using BuilderType = typename arrow::TypeTraits<ArrowType>::BuilderType;
284+
285+ static std::unique_ptr<BuilderType> make (arrow::MemoryPool* pool)
286+ {
287+ return std::make_unique<BuilderType>(pool);
288+ }
289+
290+ static std::shared_ptr<arrow::DataType> make_datatype ()
291+ {
292+ return arrow::TypeTraits<ArrowType>::type_singleton ();
293+ }
294+
295+ static arrow::Status append (BuilderType& builder, std::span<std::byte> value)
296+ {
297+ return builder.Append ((char *)value.data (), (int64_t )value.size ());
298+ }
299+ };
300+
277301template <typename ITERATOR>
278302struct BuilderMaker <std::pair<ITERATOR, ITERATOR>> {
279303 using FillType = std::pair<ITERATOR, ITERATOR>;
@@ -338,6 +362,7 @@ struct BuilderMaker<T[N]> {
338362 }
339363};
340364
365+
341366template <typename T, int N>
342367struct BuilderMaker <std::array<T, N>> {
343368 using FillType = T*;
@@ -422,6 +447,13 @@ struct DirectInsertion {
422447 return builder->Append (value);
423448 }
424449
450+ template <typename BUILDER>
451+ requires std::same_as<std::span<std::byte>, T>
452+ arrow::Status append (BUILDER& builder, T value)
453+ {
454+ return builder->Append ((char *)value.data (), (int64_t )value.size ());
455+ }
456+
425457 template <typename BUILDER>
426458 arrow::Status flush (BUILDER&)
427459 {
@@ -569,7 +601,7 @@ template <typename... ARGS>
569601using IndexedHoldersTuple = decltype (makeHolderTypes<ARGS...>());
570602
571603template <typename T>
572- concept ShouldNotDeconstruct = std::is_bounded_array_v<T> || std::is_arithmetic_v<T> || framework::is_base_of_template_v<std::vector, T>;
604+ concept ShouldNotDeconstruct = std::is_bounded_array_v<T> || std::is_arithmetic_v<T> || framework::is_base_of_template_v<std::vector, T> || std::same_as<std::span<std::byte>, T> ;
573605
574606// / Helper class which creates a lambda suitable for building
575607// / an arrow table from a tuple. This can be used, for example
0 commit comments