| 240 | |
| 241 | template <typename T> |
| 242 | static inline Status GetBitmapFromVector(const std::vector<T>& is_valid, |
| 243 | std::shared_ptr<Buffer>* result) { |
| 244 | size_t length = is_valid.size(); |
| 245 | |
| 246 | ARROW_ASSIGN_OR_RAISE(auto buffer, AllocateEmptyBitmap(length)); |
| 247 | |
| 248 | uint8_t* bitmap = buffer->mutable_data(); |
| 249 | for (size_t i = 0; i < static_cast<size_t>(length); ++i) { |
| 250 | if (is_valid[i]) { |
| 251 | bit_util::SetBit(bitmap, i); |
| 252 | } |
| 253 | } |
| 254 | |
| 255 | *result = buffer; |
| 256 | return Status::OK(); |
| 257 | } |
| 258 | |
| 259 | template <typename T> |
| 260 | inline void BitmapFromVector(const std::vector<T>& is_valid, |