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