MCPcopy Create free account
hub / github.com/apache/arrow / GetVariadicCount

Method GetVariadicCount

cpp/src/arrow/ipc/reader.cc:268–287  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

266 }
267
268 Result<int64_t> GetVariadicCount(int i) {
269 auto* variadic_counts = metadata_->variadicBufferCounts();
270 auto* buffers = metadata_->buffers();
271 CHECK_FLATBUFFERS_NOT_NULL(variadic_counts, "RecordBatch.variadicBufferCounts");
272 CHECK_FLATBUFFERS_NOT_NULL(buffers, "RecordBatch.buffers");
273 if (i >= static_cast<int>(variadic_counts->size())) {
274 return Status::IOError("variadic_count_index out of range.");
275 }
276 int64_t count = variadic_counts->Get(i);
277 if (count < 0) {
278 return Status::IOError("variadic buffer count must be positive");
279 }
280 // Detect an excessive variadic buffer count to avoid potential memory blowup
281 // (GH-48900).
282 const auto max_buffer_count = static_cast<int64_t>(buffers->size()) - buffer_index_;
283 if (count > max_buffer_count) {
284 return Status::IOError("variadic buffer count exceeds available number of buffers");
285 }
286 return count;
287 }
288
289 Status GetFieldMetadata(int field_index, ArrayData* out) {
290 auto nodes = metadata_->nodes();

Callers

nothing calls this directly

Calls 4

IOErrorFunction · 0.85
buffersMethod · 0.80
sizeMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected