Skip to content

Commit bca530c

Browse files
authored
Fix NPE in EnrichLookupService on mixed clusters with <8.14 versions (#116583)
Fixes #116529 Fixes #116544
1 parent b517abc commit bca530c

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

docs/changelog/116583.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
pr: 116583
2+
summary: Fix NPE in `EnrichLookupService` on mixed clusters with <8.14 versions
3+
area: ES|QL
4+
type: bug
5+
issues:
6+
- 116529
7+
- 116544

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/enrich/AbstractLookupService.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import org.elasticsearch.compute.operator.lookup.MergePositionsOperator;
4646
import org.elasticsearch.compute.operator.lookup.QueryList;
4747
import org.elasticsearch.core.AbstractRefCounted;
48+
import org.elasticsearch.core.Nullable;
4849
import org.elasticsearch.core.RefCounted;
4950
import org.elasticsearch.core.Releasable;
5051
import org.elasticsearch.core.Releasables;
@@ -185,7 +186,7 @@ protected static QueryList termQueryList(
185186
return switch (inputDataType) {
186187
case IP -> QueryList.ipTermQueryList(field, searchExecutionContext, (BytesRefBlock) block);
187188
case DATETIME -> QueryList.dateTermQueryList(field, searchExecutionContext, (LongBlock) block);
188-
default -> QueryList.rawTermQueryList(field, searchExecutionContext, block);
189+
case null, default -> QueryList.rawTermQueryList(field, searchExecutionContext, block);
189190
};
190191
}
191192

@@ -459,6 +460,10 @@ abstract static class Request {
459460
abstract static class TransportRequest extends org.elasticsearch.transport.TransportRequest implements IndicesRequest {
460461
final String sessionId;
461462
final ShardId shardId;
463+
/**
464+
* For mixed clusters with nodes &lt;8.14, this will be null.
465+
*/
466+
@Nullable
462467
final DataType inputDataType;
463468
final Page inputPage;
464469
final List<NamedExpression> extractFields;

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/enrich/EnrichLookupService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ static TransportRequest readFrom(StreamInput in, BlockFactory blockFactory) thro
127127
TaskId parentTaskId = TaskId.readFromStream(in);
128128
String sessionId = in.readString();
129129
ShardId shardId = new ShardId(in);
130-
DataType inputDataType = DataType.fromTypeName(
131-
(in.getTransportVersion().onOrAfter(TransportVersions.V_8_14_0)) ? in.readString() : "unknown"
132-
);
130+
DataType inputDataType = (in.getTransportVersion().onOrAfter(TransportVersions.V_8_14_0))
131+
? DataType.fromTypeName(in.readString())
132+
: null;
133133
String matchType = in.readString();
134134
String matchField = in.readString();
135135
Page inputPage;

0 commit comments

Comments
 (0)