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

Function FileBlockFromFlatbuffer

cpp/src/arrow/ipc/reader.cc:1258–1271  ·  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

1256// Common functions used in both the random-access file reader and the
1257// asynchronous generator
1258Result<FileBlock> FileBlockFromFlatbuffer(const flatbuf::Block* fb_block,
1259 int64_t max_offset) {
1260 auto block =
1261 FileBlock{fb_block->offset(), fb_block->metaDataLength(), fb_block->bodyLength()};
1262 if (block.metadata_length < 0 || block.body_length < 0 || block.offset < 0) {
1263 return Status::IOError("Invalid Block in IPC file footer");
1264 }
1265 auto block_end =
1266 AddWithOverflow<int64_t>({block.offset, block.metadata_length, block.body_length});
1267 if (!block_end.has_value() || block_end > max_offset) {
1268 return Status::IOError("Invalid Block in IPC file footer");
1269 }
1270 return block;
1271}
1272
1273Status CheckAligned(const FileBlock& block) {
1274 if (!bit_util::IsMultipleOf8(block.offset) ||

Callers 1

GetDictionaryBlockMethod · 0.85

Calls 2

IOErrorFunction · 0.85
offsetMethod · 0.45

Tested by

no test coverage detected