When evaluating expressions, defer calling advanceExact on operands until doubleValue() is called (#11878)

This commit is contained in:
Michael Sokolov 2022-10-26 14:05:39 -04:00 committed by GitHub
parent 05bd83dfe1
commit b3bc59910f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -39,21 +39,21 @@ class ExpressionFunctionValues extends DoubleValues {
}
@Override
public boolean advanceExact(int doc) throws IOException {
public boolean advanceExact(int doc) {
if (currentDoc == doc) {
return true;
}
for (DoubleValues v : functionValues) {
v.advanceExact(doc);
}
currentDoc = doc;
computed = false;
return true;
}
@Override
public double doubleValue() {
public double doubleValue() throws IOException {
if (computed == false) {
for (DoubleValues v : functionValues) {
v.advanceExact(currentDoc);
}
currentValue = expression.evaluate(functionValues);
computed = true;
}