| 1130 | } |
| 1131 | |
| 1132 | Status Ingest_some_nulls(SEXP data, const std::shared_ptr<arrow::Array>& array, |
| 1133 | R_xlen_t start, R_xlen_t n, size_t chunk_index) const { |
| 1134 | auto p_values = array->data()->GetValues<int64_t>(1); |
| 1135 | if (!p_values) { |
| 1136 | return Status::Invalid("Invalid data buffer"); |
| 1137 | } |
| 1138 | |
| 1139 | auto p_data = reinterpret_cast<int64_t*>(REAL(data)) + start; |
| 1140 | |
| 1141 | if (array->null_count()) { |
| 1142 | internal::BitmapReader bitmap_reader(array->null_bitmap()->data(), array->offset(), |
| 1143 | n); |
| 1144 | for (R_xlen_t i = 0; i < n; i++, bitmap_reader.Next(), ++p_data) { |
| 1145 | *p_data = bitmap_reader.IsSet() ? p_values[i] : NA_INT64; |
| 1146 | } |
| 1147 | } else { |
| 1148 | std::copy_n(p_values, n, p_data); |
| 1149 | } |
| 1150 | |
| 1151 | return Status::OK(); |
| 1152 | } |
| 1153 | }; |
| 1154 | |
| 1155 | class Converter_Null : public Converter { |