Skip to content

Commit f1491d8

Browse files
committed
fix: don't subtract file index if checking mem range
Signed-off-by: evenyag <[email protected]>
1 parent 55d8181 commit f1491d8

File tree

1 file changed

+20
-17
lines changed

1 file changed

+20
-17
lines changed

src/mito2/src/read/scan_util.rs

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -725,24 +725,27 @@ pub(crate) fn should_split_flat_batches_for_merge(
725725
num_mem_series += stats.series_count();
726726
} else if !stream_ctx.is_file_range_index(*index) {
727727
// Skips non-file and non-mem ranges.
728-
continue;
729-
}
730-
let file_index = index.index - stream_ctx.input.num_memtables();
731-
let file = &stream_ctx.input.files[file_index];
732-
if file.meta_ref().num_rows < SPLIT_ROW_THRESHOLD {
733-
// If the file doesn't have enough rows, skips it.
734-
continue;
735-
}
736-
if file.meta_ref().num_series == 0 {
737-
// Number of series is unavailable.
738-
continue;
739-
}
740-
debug_assert!(file.meta_ref().num_rows > 0);
741-
if !can_split_series(file.meta_ref().num_rows, file.meta_ref().num_series) {
742-
// We don't skip if we find that we can't split batches in a file.
743-
return false;
744728
} else {
745-
num_scan_files += 1;
729+
assert!(stream_ctx.is_file_range_index(*index));
730+
731+
// This is a file range.
732+
let file_index = index.index - stream_ctx.input.num_memtables();
733+
let file = &stream_ctx.input.files[file_index];
734+
if file.meta_ref().num_rows < SPLIT_ROW_THRESHOLD {
735+
// If the file doesn't have enough rows, skips it.
736+
continue;
737+
}
738+
if file.meta_ref().num_series == 0 {
739+
// Number of series is unavailable.
740+
continue;
741+
}
742+
debug_assert!(file.meta_ref().num_rows > 0);
743+
if !can_split_series(file.meta_ref().num_rows, file.meta_ref().num_series) {
744+
// We don't skip if we find that we can't split batches in a file.
745+
return false;
746+
} else {
747+
num_scan_files += 1;
748+
}
746749
}
747750
}
748751

0 commit comments

Comments
 (0)