23
23
import org .elasticsearch .compute .data .BlockStreamInput ;
24
24
import org .elasticsearch .compute .data .Page ;
25
25
import org .elasticsearch .compute .operator .lookup .QueryList ;
26
+ import org .elasticsearch .core .Nullable ;
26
27
import org .elasticsearch .core .Releasables ;
27
28
import org .elasticsearch .index .mapper .MappedFieldType ;
28
29
import org .elasticsearch .index .mapper .RangeFieldMapper ;
@@ -98,7 +99,12 @@ protected TransportRequest transportRequest(EnrichLookupService.Request request,
98
99
}
99
100
100
101
@ Override
101
- protected QueryList queryList (TransportRequest request , SearchExecutionContext context , Block inputBlock , DataType inputDataType ) {
102
+ protected QueryList queryList (
103
+ TransportRequest request ,
104
+ SearchExecutionContext context ,
105
+ Block inputBlock ,
106
+ @ Nullable DataType inputDataType
107
+ ) {
102
108
MappedFieldType fieldType = context .getFieldType (request .matchField );
103
109
validateTypes (inputDataType , fieldType );
104
110
return switch (request .matchType ) {
@@ -121,8 +127,8 @@ protected LookupResponse readLookupResponse(StreamInput in, BlockFactory blockFa
121
127
return new LookupResponse (in , blockFactory );
122
128
}
123
129
124
- private static void validateTypes (DataType inputDataType , MappedFieldType fieldType ) {
125
- if (fieldType instanceof RangeFieldMapper .RangeFieldType rangeType ) {
130
+ private static void validateTypes (@ Nullable DataType inputDataType , MappedFieldType fieldType ) {
131
+ if (fieldType instanceof RangeFieldMapper .RangeFieldType rangeType && inputDataType != null ) {
126
132
// For range policy types, the ENRICH index field type will be one of a list of supported range types,
127
133
// which need to match the input data type (eg. ip-range -> ip, date-range -> date, etc.)
128
134
if (rangeTypesCompatible (rangeType .rangeType (), inputDataType ) == false ) {
@@ -135,7 +141,7 @@ private static void validateTypes(DataType inputDataType, MappedFieldType fieldT
135
141
// For geo_match, type validation is done earlier, in the Analyzer.
136
142
}
137
143
138
- private static boolean rangeTypesCompatible (RangeType rangeType , DataType inputDataType ) {
144
+ private static boolean rangeTypesCompatible (RangeType rangeType , @ Nullable DataType inputDataType ) {
139
145
if (inputDataType .noText () == DataType .KEYWORD ) {
140
146
// We allow runtime parsing of string types to numeric types
141
147
return true ;
0 commit comments