| 250 | } |
| 251 | |
| 252 | Status GetBuffer(int buffer_index, std::shared_ptr<Buffer>* out) { |
| 253 | auto* buffers = metadata_->buffers(); |
| 254 | CHECK_FLATBUFFERS_NOT_NULL(buffers, "RecordBatch.buffers"); |
| 255 | if (buffer_index >= static_cast<int>(buffers->size())) { |
| 256 | return Status::IOError("buffer_index out of range."); |
| 257 | } |
| 258 | const flatbuf::Buffer* buffer = buffers->Get(buffer_index); |
| 259 | if (buffer->length() == 0) { |
| 260 | // Should never return a null buffer here. |
| 261 | // (zero-sized buffer allocations are cheap) |
| 262 | return AllocateBuffer(0).Value(out); |
| 263 | } else { |
| 264 | return ReadBuffer(buffer->offset(), buffer->length(), out); |
| 265 | } |
| 266 | } |
| 267 | |
| 268 | Result<int64_t> GetVariadicCount(int i) { |
| 269 | auto* variadic_counts = metadata_->variadicBufferCounts(); |
no test coverage detected