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

Function FileBlockFromFlatbuffer

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

Common functions used in both the random-access file reader and the asynchronous generator

Source from the content-addressed store, hash-verified

1236// Common functions used in both the random-access file reader and the
1237// asynchronous generator
1238Result<FileBlock> FileBlockFromFlatbuffer(const flatbuf::Block* fb_block,
1239 int64_t max_offset) {
1240 auto block =
1241 FileBlock{fb_block->offset(), fb_block->metaDataLength(), fb_block->bodyLength()};
1242 if (block.metadata_length < 0 || block.body_length < 0 || block.offset < 0) {
1243 return Status::IOError("Invalid Block in IPC file footer");
1244 }
1245 auto block_end =
1246 AddWithOverflow<int64_t>({block.offset, block.metadata_length, block.body_length});
1247 if (!block_end.has_value() || block_end > max_offset) {
1248 return Status::IOError("Invalid Block in IPC file footer");
1249 }
1250 return block;
1251}
1252
1253Status CheckAligned(const FileBlock& block) {
1254 if (!bit_util::IsMultipleOf8(block.offset) ||

Callers 2

GetRecordBatchBlockMethod · 0.85
GetDictionaryBlockMethod · 0.85

Calls 2

IOErrorFunction · 0.85
offsetMethod · 0.45

Tested by

no test coverage detected