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 @Override
public boolean advanceExact(int doc) throws IOException { public boolean advanceExact(int doc) {
if (currentDoc == doc) { if (currentDoc == doc) {
return true; return true;
} }
for (DoubleValues v : functionValues) {
v.advanceExact(doc);
}
currentDoc = doc; currentDoc = doc;
computed = false; computed = false;
return true; return true;
} }
@Override @Override
public double doubleValue() { public double doubleValue() throws IOException {
if (computed == false) { if (computed == false) {
for (DoubleValues v : functionValues) {
v.advanceExact(currentDoc);
}
currentValue = expression.evaluate(functionValues); currentValue = expression.evaluate(functionValues);
computed = true; computed = true;
} }