Skip to content

Commit 0bec672

Browse files
committed
Add float16 logic
1 parent 98a92c2 commit 0bec672

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

r/src/array_to_vector.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <arrow/table.h>
2424
#include <arrow/util/bitmap_reader.h>
2525
#include <arrow/util/bitmap_writer.h>
26+
#include <arrow/util/float16.h>
2627
#include <arrow/util/int_util.h>
2728

2829
#include <type_traits>
@@ -224,7 +225,11 @@ class Converter_Double : public Converter {
224225
}
225226
auto p_data = REAL(data) + start;
226227
auto ingest_one = [&](R_xlen_t i) {
227-
p_data[i] = static_cast<value_type>(p_values[i]);
228+
if constexpr (std::is_same_v<Type, HalfFloatType>) {
229+
p_data[i] = arrow::util::Float16::FromBits(p_values[i]).ToDouble();
230+
} else {
231+
p_data[i] = static_cast<value_type>(p_values[i]);
232+
}
228233
return Status::OK();
229234
};
230235
auto null_one = [&](R_xlen_t i) {

0 commit comments

Comments
 (0)