Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion cpp/array_record_reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,14 @@ void ArrayRecordReaderBase::Initialize() {
}
}

uint64_t ArrayRecordReaderBase::ChunkStartOffset(uint64_t chunk_idx) const {
return state_->chunk_offsets[chunk_idx];
}

uint64_t ArrayRecordReaderBase::ChunkEndOffset(uint64_t chunk_idx) const {
return state_->ChunkEndOffset(chunk_idx);
}

absl::Status ArrayRecordReaderBase::ParallelReadRecords(
absl::FunctionRef<absl::Status(uint64_t, absl::string_view)> callback)
const {
Expand Down Expand Up @@ -591,7 +599,7 @@ uint64_t ArrayRecordReaderBase::NumRecords() const {
return state_->num_records;
}

uint64_t ArrayRecordReaderBase::RecordGroupSize() {
uint64_t ArrayRecordReaderBase::RecordGroupSize() const {
if (!ok()) {
return 0;
}
Expand Down
4 changes: 3 additions & 1 deletion cpp/array_record_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ class ArrayRecordReaderBase : public riegeli::Object {
// Number of records in each compressed chunk configured at the file writing
// stage by `ArrayRecordWriterBase::Options::set_group_size`. The acutal
// number of records per group could be smaller equals to this number.
uint64_t RecordGroupSize();
uint64_t RecordGroupSize() const;

// Index of the record to be read.
uint64_t RecordIndex() const;
Expand Down Expand Up @@ -287,6 +287,8 @@ class ArrayRecordReaderBase : public riegeli::Object {
ArrayRecordReaderBase& operator=(ArrayRecordReaderBase&& other) noexcept;

void Initialize();
uint64_t ChunkStartOffset(uint64_t chunk_idx) const;
uint64_t ChunkEndOffset(uint64_t chunk_idx) const;

virtual ThreadCompatibleSharedPtr<riegeli::Reader> get_backing_reader()
const = 0;
Expand Down
Binary file modified python/testdata/digits.array_record-00000-of-00002
Binary file not shown.
Binary file modified python/testdata/digits.array_record-00001-of-00002
Binary file not shown.