Skip to content

Commit bec05a1

Browse files
authored
Early exit while computing globalMin/Max using skipper (#15127)
--------- Signed-off-by: Ankit Jain <[email protected]>
1 parent 039e787 commit bec05a1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lucene/core/src/java/org/apache/lucene/index/DocValuesSkipper.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ public static long globalMinValue(IndexSearcher searcher, String field) throws I
139139
}
140140
DocValuesSkipper skipper = ctx.reader().getDocValuesSkipper(field);
141141
if (skipper == null) {
142-
minValue = Long.MIN_VALUE;
142+
// minimum cannot be computed correctly since skipper is not enabled for some leaf
143+
return Long.MIN_VALUE;
143144
} else {
144145
minValue = Math.min(minValue, skipper.minValue());
145146
}
@@ -162,7 +163,8 @@ public static long globalMaxValue(IndexSearcher searcher, String field) throws I
162163
}
163164
DocValuesSkipper skipper = ctx.reader().getDocValuesSkipper(field);
164165
if (skipper == null) {
165-
maxValue = Long.MAX_VALUE;
166+
// maximum cannot be computed correctly since skipper is not enabled for some leaf
167+
return Long.MAX_VALUE;
166168
} else {
167169
maxValue = Math.max(maxValue, skipper.maxValue());
168170
}

0 commit comments

Comments
 (0)