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

Method ReadAt

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

Source from the content-addressed store, hash-verified

3001Result<int64_t> IoRecordedRandomAccessFile::GetSize() { return file_size_; }
3002
3003Result<int64_t> IoRecordedRandomAccessFile::ReadAt(int64_t position, int64_t nbytes,
3004 bool allow_short_read, void* out) {
3005 auto num_bytes_read = std::min(file_size_, position + nbytes) - position;
3006 if (!allow_short_read && num_bytes_read != nbytes) {
3007 return Status::IOError("File too short: expected to be able to read ", nbytes,
3008 " bytes, got ", num_bytes_read);
3009 }
3010
3011 if (!read_ranges_.empty() &&
3012 position == read_ranges_.back().offset + read_ranges_.back().length) {
3013 // merge continuous IOs into one if possible
3014 read_ranges_.back().length += num_bytes_read;
3015 } else {
3016 // no real IO is performed, it is only saved into a vector for replaying later
3017 read_ranges_.emplace_back(io::ReadRange{position, num_bytes_read});
3018 }
3019 return num_bytes_read;
3020}
3021
3022Result<std::shared_ptr<Buffer>> IoRecordedRandomAccessFile::ReadAt(
3023 int64_t position, int64_t nbytes, bool allow_short_read) {

Callers 8

ReadBufferMethod · 0.45
ReadSparseCSFIndexFunction · 0.45
ReadFieldsSubsetFunction · 0.45
ReadMessageContinuedFunction · 0.45
ReadMessageInternalFunction · 0.45
TEST_FFunction · 0.45
TESTFunction · 0.45
OpenMethod · 0.45

Calls 5

IOErrorFunction · 0.85
ReadAtFunction · 0.85
backMethod · 0.80
emplace_backMethod · 0.80
emptyMethod · 0.45

Tested by 2

TEST_FFunction · 0.36
TESTFunction · 0.36