From 5c9e0d906a572a12098ea368598d894699192aa5 Mon Sep 17 00:00:00 2001 From: airborne12 Date: Sat, 30 Dec 2023 08:36:15 +0800 Subject: [PATCH] [Fix](segment iterator) fix wrong segment cache remove (#29333) --- be/src/olap/rowset/segment_v2/segment_iterator.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/be/src/olap/rowset/segment_v2/segment_iterator.cpp b/be/src/olap/rowset/segment_v2/segment_iterator.cpp index 6bc01ea0d4be6e..5c30423bb53d44 100644 --- a/be/src/olap/rowset/segment_v2/segment_iterator.cpp +++ b/be/src/olap/rowset/segment_v2/segment_iterator.cpp @@ -2074,7 +2074,8 @@ Status SegmentIterator::_read_columns_by_rowids(std::vector& read_colu Status SegmentIterator::next_batch(vectorized::Block* block) { auto status = [&]() { RETURN_IF_CATCH_EXCEPTION({ return _next_batch_internal(block); }); }(); - if (!status.ok()) { + // if rows read by batch is 0, will return end of file, we should not remove segment cache in this situation. + if (!status.ok() && !status.is()) { _segment->remove_from_segment_cache(); } return status;