Apache Lucene open-source search software
Early exit while computing globalMin/Max using skipper (#15127)
Ankit Jainbec05a1c2c2d
diff --git a/lucene/core/src/java/org/apache/lucene/index/DocValuesSkipper.java b/lucene/core/src/java/org/apache/lucene/index/DocValuesSkipper.javaindex 6f1c06bb608..93fd72faba1 100644--- a/lucene/core/src/java/org/apache/lucene/index/DocValuesSkipper.java+++ b/lucene/core/src/java/org/apache/lucene/index/DocValuesSkipper.java@@ -139,7 +139,8 @@ public abstract class DocValuesSkipper {}DocValuesSkipper skipper = ctx.reader().getDocValuesSkipper(field);if (skipper == null) {- minValue = Long.MIN_VALUE;+ // minimum cannot be computed correctly since skipper is not enabled for some leaf+ return Long.MIN_VALUE;} else {minValue = Math.min(minValue, skipper.minValue());}@@ -162,7 +163,8 @@ public abstract class DocValuesSkipper {}DocValuesSkipper skipper = ctx.reader().getDocValuesSkipper(field);if (skipper == null) {- maxValue = Long.MAX_VALUE;+ // maximum cannot be computed correctly since skipper is not enabled for some leaf+ return Long.MAX_VALUE;} else {maxValue = Math.max(maxValue, skipper.maxValue());}