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

Method ReadAt

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

Source from the content-addressed store, hash-verified

2982Result<int64_t> IoRecordedRandomAccessFile::GetSize() { return file_size_; }
2983
2984Result<int64_t> IoRecordedRandomAccessFile::ReadAt(int64_t position, int64_t nbytes,
2985 bool allow_short_read, void* out) {
2986 auto num_bytes_read = std::min(file_size_, position + nbytes) - position;
2987 if (!allow_short_read && num_bytes_read != nbytes) {
2988 return Status::IOError("File too short: expected to be able to read ", nbytes,
2989 " bytes, got ", num_bytes_read);
2990 }
2991
2992 if (!read_ranges_.empty() &&
2993 position == read_ranges_.back().offset + read_ranges_.back().length) {
2994 // merge continuous IOs into one if possible
2995 read_ranges_.back().length += num_bytes_read;
2996 } else {
2997 // no real IO is performed, it is only saved into a vector for replaying later
2998 read_ranges_.emplace_back(io::ReadRange{position, num_bytes_read});
2999 }
3000 return num_bytes_read;
3001}
3002
3003Result<std::shared_ptr<Buffer>> IoRecordedRandomAccessFile::ReadAt(
3004 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