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