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

Method ReadAt

cpp/src/arrow/filesystem/s3fs.cc:1512–1532  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1510 }
1511
1512 Result<int64_t> ReadAt(int64_t position, int64_t nbytes, void* out) override {
1513 RETURN_NOT_OK(CheckClosed());
1514 RETURN_NOT_OK(CheckPosition(position, "read"));
1515
1516 nbytes = std::min(nbytes, content_length_ - position);
1517 if (nbytes == 0) {
1518 return 0;
1519 }
1520
1521 // Read the desired range of bytes
1522 ARROW_ASSIGN_OR_RAISE(auto client_lock, holder_->Lock());
1523 ARROW_ASSIGN_OR_RAISE(S3Model::GetObjectResult result,
1524 GetObjectRange(client_lock.get(), path_, sse_customer_key_,
1525 position, nbytes, out));
1526
1527 auto& stream = result.GetBody();
1528 stream.ignore(nbytes);
1529 // NOTE: the stream is a stringstream by default, there is no actual error
1530 // to check for. However, stream.fail() may return true if EOF is reached.
1531 return stream.gcount();
1532 }
1533
1534 Result<std::shared_ptr<Buffer>> ReadAt(int64_t position, int64_t nbytes) override {
1535 RETURN_NOT_OK(CheckClosed());

Callers 8

TEST_FFunction · 0.45
TestOpenInputFileMethod · 0.45
TEST_FFunction · 0.45
TestBucketFunction · 0.45
TEST_FFunction · 0.45
NaiveReadFunction · 0.45
ChunkedReadFunction · 0.45

Calls 2

CheckClosedFunction · 0.50
ResizeMethod · 0.45

Tested by 6

TEST_FFunction · 0.36
TestOpenInputFileMethod · 0.36
TEST_FFunction · 0.36
TestBucketFunction · 0.36
TEST_FFunction · 0.36