Apache Lucene open-source search software
LUCENE-10656: It is unnecessary that using `limit` to check boundary (#1027)
Lu Xugang39e7597f6e83
diff --git a/lucene/core/src/java/org/apache/lucene/index/SortedNumericDocValuesWriter.java b/lucene/core/src/java/org/apache/lucene/index/SortedNumericDocValuesWriter.javaindex 66a28374c3d..5d303118028 100644--- a/lucene/core/src/java/org/apache/lucene/index/SortedNumericDocValuesWriter.java+++ b/lucene/core/src/java/org/apache/lucene/index/SortedNumericDocValuesWriter.java@@ -253,9 +253,6 @@ class SortedNumericDocValuesWriter extends DocValuesWriter<SortedNumericDocValue@Overridepublic long nextValue() {- if (valueUpto == valueCount) {- throw new IllegalStateException();- }valueUpto++;return valuesIter.next();}@@ -272,7 +269,6 @@ class SortedNumericDocValuesWriter extends DocValuesWriter<SortedNumericDocValueprivate int docID = -1;private long upto;private int numValues = -1;- private long limit;SortingSortedNumericDocValues(SortedNumericDocValues in, LongValues values) {this.in = in;@@ -294,7 +290,6 @@ class SortedNumericDocValuesWriter extends DocValuesWriter<SortedNumericDocValue} while (values.offsets[docID] <= 0);upto = values.offsets[docID];numValues = Math.toIntExact(values.values.get(upto - 1));- limit = upto + numValues;return docID;}@@ -309,21 +304,14 @@ class SortedNumericDocValuesWriter extends DocValuesWriter<SortedNumericDocValueupto = values.offsets[docID];if (values.offsets[docID] > 0) {numValues = Math.toIntExact(values.values.get(upto - 1));- limit = upto + numValues;return true;- } else {- limit = upto;}return false;}@Overridepublic long nextValue() {- if (upto == limit) {- throw new AssertionError();- } else {- return values.values.get(upto++);- }+ return values.values.get(upto++);}@Override