Skip to content

Commit ec0dc4e

Browse files
committed
Fix some problems with NOT
1 parent b740da3 commit ec0dc4e

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/lucene/LuceneQueryExpressionEvaluator.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,12 @@ private Tuple<BooleanVector, DoubleVector> evalSlow(DocVector docs) throws IOExc
179179
}
180180

181181
@Override
182-
public void close() {}
182+
public void close() {
183+
if ((scoreVector != null) && scoreVector.isReleased() == false) {
184+
// Scores may not be retrieved calling score(), for example with NOT. Try to free up the score vector
185+
Releasables.closeExpectNoException(scoreVector);
186+
}
187+
}
183188

184189
private ShardState shardState(int shard) throws IOException {
185190
if (shard >= perShardState.length) {

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/evaluator/EvalMapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ public ExpressionEvaluator.Factory map(
212212
List<ShardContext> shardContexts,
213213
boolean usesScoring
214214
) {
215-
var expEval = toEvaluator(foldCtx, not.field(), layout);
215+
var expEval = toEvaluator(foldCtx, not.field(), layout, shardContexts, usesScoring);
216216
return dvrCtx -> new org.elasticsearch.xpack.esql.evaluator.predicate.operator.logical.NotEvaluator(
217217
not.source(),
218218
expEval.get(dvrCtx),

0 commit comments

Comments
 (0)