From 551cc78bf3b20c8e1e2ed96d03aa7cfba1ec32be Mon Sep 17 00:00:00 2001 From: lixueclaire Date: Tue, 18 Apr 2023 09:24:43 +0800 Subject: [PATCH] [BugFix][C++] Fix next_chunk() of readers in the C++ library (#137) --- cpp/include/gar/reader/arrow_chunk_reader.h | 6 ++++-- cpp/include/gar/reader/chunk_info_reader.h | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/cpp/include/gar/reader/arrow_chunk_reader.h b/cpp/include/gar/reader/arrow_chunk_reader.h index 2cc04bc9e..a4da2359e 100644 --- a/cpp/include/gar/reader/arrow_chunk_reader.h +++ b/cpp/include/gar/reader/arrow_chunk_reader.h @@ -236,7 +236,8 @@ class AdjListArrowChunkReader { */ Status next_chunk() { Status st; - if (++chunk_index_ >= chunk_num_) { + ++chunk_index_; + while (chunk_index_ >= chunk_num_) { st = Status::EndOfChunk(); ++vertex_chunk_index_; if (vertex_chunk_index_ >= vertex_chunk_num_) { @@ -494,7 +495,8 @@ class AdjListPropertyArrowChunkReader { */ Status next_chunk() { Status st; - if (++chunk_index_ >= chunk_num_) { + ++chunk_index_; + while (chunk_index_ >= chunk_num_) { st = Status::EndOfChunk(); ++vertex_chunk_index_; if (vertex_chunk_index_ >= vertex_chunk_num_) { diff --git a/cpp/include/gar/reader/chunk_info_reader.h b/cpp/include/gar/reader/chunk_info_reader.h index 556398d6c..9416e3493 100644 --- a/cpp/include/gar/reader/chunk_info_reader.h +++ b/cpp/include/gar/reader/chunk_info_reader.h @@ -186,7 +186,8 @@ class AdjListChunkInfoReader { * error. */ Status next_chunk() { - if (++chunk_index_ >= chunk_num_) { + ++chunk_index_; + while (chunk_index_ >= chunk_num_) { ++vertex_chunk_index_; if (vertex_chunk_index_ >= vertex_chunk_num_) { return Status::OutOfRange(); @@ -290,7 +291,8 @@ class AdjListPropertyChunkInfoReader { * error. */ Status next_chunk() { - if (++chunk_index_ >= chunk_num_) { + ++chunk_index_; + while (chunk_index_ >= chunk_num_) { ++vertex_chunk_index_; if (vertex_chunk_index_ >= vertex_chunk_num_) { return Status::OutOfRange();