Skip to content

Commit

Permalink
Fix NPE in EnrichLookupService on mixed clusters with <8.14 versions (e…
Browse files Browse the repository at this point in the history
  • Loading branch information
ivancea authored Nov 11, 2024
1 parent b517abc commit bca530c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
7 changes: 7 additions & 0 deletions docs/changelog/116583.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pr: 116583
summary: Fix NPE in `EnrichLookupService` on mixed clusters with <8.14 versions
area: ES|QL
type: bug
issues:
- 116529
- 116544
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import org.elasticsearch.compute.operator.lookup.MergePositionsOperator;
import org.elasticsearch.compute.operator.lookup.QueryList;
import org.elasticsearch.core.AbstractRefCounted;
import org.elasticsearch.core.Nullable;
import org.elasticsearch.core.RefCounted;
import org.elasticsearch.core.Releasable;
import org.elasticsearch.core.Releasables;
Expand Down Expand Up @@ -185,7 +186,7 @@ protected static QueryList termQueryList(
return switch (inputDataType) {
case IP -> QueryList.ipTermQueryList(field, searchExecutionContext, (BytesRefBlock) block);
case DATETIME -> QueryList.dateTermQueryList(field, searchExecutionContext, (LongBlock) block);
default -> QueryList.rawTermQueryList(field, searchExecutionContext, block);
case null, default -> QueryList.rawTermQueryList(field, searchExecutionContext, block);
};
}

Expand Down Expand Up @@ -459,6 +460,10 @@ abstract static class Request {
abstract static class TransportRequest extends org.elasticsearch.transport.TransportRequest implements IndicesRequest {
final String sessionId;
final ShardId shardId;
/**
* For mixed clusters with nodes &lt;8.14, this will be null.
*/
@Nullable
final DataType inputDataType;
final Page inputPage;
final List<NamedExpression> extractFields;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ static TransportRequest readFrom(StreamInput in, BlockFactory blockFactory) thro
TaskId parentTaskId = TaskId.readFromStream(in);
String sessionId = in.readString();
ShardId shardId = new ShardId(in);
DataType inputDataType = DataType.fromTypeName(
(in.getTransportVersion().onOrAfter(TransportVersions.V_8_14_0)) ? in.readString() : "unknown"
);
DataType inputDataType = (in.getTransportVersion().onOrAfter(TransportVersions.V_8_14_0))
? DataType.fromTypeName(in.readString())
: null;
String matchType = in.readString();
String matchField = in.readString();
Page inputPage;
Expand Down

0 comments on commit bca530c

Please sign in to comment.