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

Function FileBlockFromFlatbuffer

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

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