LUCENE-10656: It is unnecessary that using `limit` to check boundary (#1027)

This commit is contained in:
Lu Xugang 2022-07-20 10:00:06 +08:00 committed by GitHub
parent 28ce8abb51
commit 39e7597f6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 13 deletions

View File

@ -253,9 +253,6 @@ class SortedNumericDocValuesWriter extends DocValuesWriter<SortedNumericDocValue
@Override
public long nextValue() {
if (valueUpto == valueCount) {
throw new IllegalStateException();
}
valueUpto++;
return valuesIter.next();
}
@ -272,7 +269,6 @@ class SortedNumericDocValuesWriter extends DocValuesWriter<SortedNumericDocValue
private 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<SortedNumericDocValue
upto = 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;
}
@Override
public long nextValue() {
if (upto == limit) {
throw new AssertionError();
} else {
return values.values.get(upto++);
}
return values.values.get(upto++);
}
@Override