2424import org .elasticsearch .compute .data .Page ;
2525import org .elasticsearch .compute .operator .Warnings ;
2626import org .elasticsearch .compute .operator .lookup .QueryList ;
27+ import org .elasticsearch .core .Nullable ;
2728import org .elasticsearch .core .Releasables ;
2829import org .elasticsearch .index .mapper .MappedFieldType ;
2930import org .elasticsearch .index .mapper .RangeFieldMapper ;
@@ -103,7 +104,7 @@ protected QueryList queryList(
103104 TransportRequest request ,
104105 SearchExecutionContext context ,
105106 Block inputBlock ,
106- DataType inputDataType ,
107+ @ Nullable DataType inputDataType ,
107108 Warnings warnings
108109 ) {
109110 MappedFieldType fieldType = context .getFieldType (request .matchField );
@@ -128,8 +129,8 @@ protected LookupResponse readLookupResponse(StreamInput in, BlockFactory blockFa
128129 return new LookupResponse (in , blockFactory );
129130 }
130131
131- private static void validateTypes (DataType inputDataType , MappedFieldType fieldType ) {
132- if (fieldType instanceof RangeFieldMapper .RangeFieldType rangeType ) {
132+ private static void validateTypes (@ Nullable DataType inputDataType , MappedFieldType fieldType ) {
133+ if (fieldType instanceof RangeFieldMapper .RangeFieldType rangeType && inputDataType != null ) {
133134 // For range policy types, the ENRICH index field type will be one of a list of supported range types,
134135 // which need to match the input data type (eg. ip-range -> ip, date-range -> date, etc.)
135136 if (rangeTypesCompatible (rangeType .rangeType (), inputDataType ) == false ) {
@@ -142,7 +143,7 @@ private static void validateTypes(DataType inputDataType, MappedFieldType fieldT
142143 // For geo_match, type validation is done earlier, in the Analyzer.
143144 }
144145
145- private static boolean rangeTypesCompatible (RangeType rangeType , DataType inputDataType ) {
146+ private static boolean rangeTypesCompatible (RangeType rangeType , @ Nullable DataType inputDataType ) {
146147 if (inputDataType .noText () == DataType .KEYWORD ) {
147148 // We allow runtime parsing of string types to numeric types
148149 return true ;
0 commit comments