| 1222 | } |
| 1223 | |
| 1224 | Status Ingest_some_nulls(SEXP data, const std::shared_ptr<arrow::Array>& array, |
| 1225 | R_xlen_t start, R_xlen_t n, size_t chunk_index) const { |
| 1226 | auto p_values = array->data()->GetValues<int64_t>(1); |
| 1227 | if (!p_values) { |
| 1228 | return Status::Invalid("Invalid data buffer"); |
| 1229 | } |
| 1230 | |
| 1231 | auto p_data = reinterpret_cast<int64_t*>(REAL(data)) + start; |
| 1232 | |
| 1233 | if (array->null_count()) { |
| 1234 | internal::BitmapReader bitmap_reader(array->null_bitmap()->data(), array->offset(), |
| 1235 | n); |
| 1236 | for (R_xlen_t i = 0; i < n; i++, bitmap_reader.Next(), ++p_data) { |
| 1237 | *p_data = bitmap_reader.IsSet() ? p_values[i] : NA_INT64; |
| 1238 | } |
| 1239 | } else { |
| 1240 | std::copy_n(p_values, n, p_data); |
| 1241 | } |
| 1242 | |
| 1243 | return Status::OK(); |
| 1244 | } |
| 1245 | }; |
| 1246 | |
| 1247 | class Converter_Null : public Converter { |