@@ -57,7 +57,6 @@ public ValuesSource getScript(AggregationScript.LeafFactory script, ValueType sc
57
57
public ValuesSource getField (FieldContext fieldContext , AggregationScript .LeafFactory script ) {
58
58
59
59
if ((fieldContext .indexFieldData () instanceof IndexNumericFieldData ) == false ) {
60
- // TODO: Is this the correct exception type here?
61
60
throw new IllegalArgumentException ("Expected numeric type on field [" + fieldContext .field () +
62
61
"], but got [" + fieldContext .fieldType ().typeName () + "]" );
63
62
}
@@ -71,8 +70,9 @@ public ValuesSource getField(FieldContext fieldContext, AggregationScript.LeafFa
71
70
}
72
71
73
72
@ Override
74
- public ValuesSource replaceMissing (ValuesSource valuesSource , Object rawMissing , DocValueFormat docValueFormat , LongSupplier now ) {
75
- Number missing = docValueFormat .parseDouble (rawMissing .toString (), false , now );
73
+ public ValuesSource replaceMissing (ValuesSource valuesSource , Object rawMissing , DocValueFormat docValueFormat ,
74
+ LongSupplier nowSupplier ) {
75
+ Number missing = docValueFormat .parseDouble (rawMissing .toString (), false , nowSupplier );
76
76
return MissingValues .replaceMissing ((ValuesSource .Numeric ) valuesSource , missing );
77
77
}
78
78
},
@@ -104,7 +104,8 @@ public ValuesSource getField(FieldContext fieldContext, AggregationScript.LeafFa
104
104
}
105
105
106
106
@ Override
107
- public ValuesSource replaceMissing (ValuesSource valuesSource , Object rawMissing , DocValueFormat docValueFormat , LongSupplier now ) {
107
+ public ValuesSource replaceMissing (ValuesSource valuesSource , Object rawMissing , DocValueFormat docValueFormat ,
108
+ LongSupplier nowSupplier ) {
108
109
final BytesRef missing = docValueFormat .parseBytesRef (rawMissing .toString ());
109
110
if (valuesSource instanceof ValuesSource .Bytes .WithOrdinals ) {
110
111
return MissingValues .replaceMissing ((ValuesSource .Bytes .WithOrdinals ) valuesSource , missing );
@@ -127,7 +128,6 @@ public ValuesSource getScript(AggregationScript.LeafFactory script, ValueType sc
127
128
@ Override
128
129
public ValuesSource getField (FieldContext fieldContext , AggregationScript .LeafFactory script ) {
129
130
if (!(fieldContext .indexFieldData () instanceof IndexGeoPointFieldData )) {
130
- // TODO: Is this the correct exception type here?
131
131
throw new IllegalArgumentException ("Expected geo_point type on field [" + fieldContext .field () +
132
132
"], but got [" + fieldContext .fieldType ().typeName () + "]" );
133
133
}
@@ -136,7 +136,8 @@ public ValuesSource getField(FieldContext fieldContext, AggregationScript.LeafFa
136
136
}
137
137
138
138
@ Override
139
- public ValuesSource replaceMissing (ValuesSource valuesSource , Object rawMissing , DocValueFormat docValueFormat , LongSupplier now ) {
139
+ public ValuesSource replaceMissing (ValuesSource valuesSource , Object rawMissing , DocValueFormat docValueFormat ,
140
+ LongSupplier nowSupplier ) {
140
141
// TODO: also support the structured formats of geo points
141
142
final GeoPoint missing = new GeoPoint (rawMissing .toString ());
142
143
return MissingValues .replaceMissing ((ValuesSource .GeoPoint ) valuesSource , missing );
@@ -150,7 +151,6 @@ public DocValueFormat getFormatter(String format, ZoneId tz) {
150
151
RANGE () {
151
152
@ Override
152
153
public ValuesSource getEmpty () {
153
- // TODO: Is this the correct exception type here?
154
154
throw new IllegalArgumentException ("Can't deal with unmapped ValuesSource type " + this .value ());
155
155
}
156
156
@@ -164,15 +164,15 @@ public ValuesSource getField(FieldContext fieldContext, AggregationScript.LeafFa
164
164
MappedFieldType fieldType = fieldContext .fieldType ();
165
165
166
166
if (fieldType instanceof RangeFieldMapper .RangeFieldType == false ) {
167
- // TODO: Is this the correct exception type here?
168
- throw new IllegalStateException ("Asked for range ValuesSource, but field is of type " + fieldType .name ());
167
+ throw new IllegalArgumentException ("Asked for range ValuesSource, but field is of type " + fieldType .name ());
169
168
}
170
169
RangeFieldMapper .RangeFieldType rangeFieldType = (RangeFieldMapper .RangeFieldType ) fieldType ;
171
170
return new ValuesSource .Range (fieldContext .indexFieldData (), rangeFieldType .rangeType ());
172
171
}
173
172
174
173
@ Override
175
- public ValuesSource replaceMissing (ValuesSource valuesSource , Object rawMissing , DocValueFormat docValueFormat , LongSupplier now ) {
174
+ public ValuesSource replaceMissing (ValuesSource valuesSource , Object rawMissing , DocValueFormat docValueFormat ,
175
+ LongSupplier nowSupplier ) {
176
176
throw new IllegalArgumentException ("Can't apply missing values on a " + valuesSource .getClass ());
177
177
}
178
178
},
@@ -193,8 +193,9 @@ public ValuesSource getField(FieldContext fieldContext, AggregationScript.LeafFa
193
193
}
194
194
195
195
@ Override
196
- public ValuesSource replaceMissing (ValuesSource valuesSource , Object rawMissing , DocValueFormat docValueFormat , LongSupplier now ) {
197
- return BYTES .replaceMissing (valuesSource , rawMissing , docValueFormat , now );
196
+ public ValuesSource replaceMissing (ValuesSource valuesSource , Object rawMissing , DocValueFormat docValueFormat ,
197
+ LongSupplier nowSupplier ) {
198
+ return BYTES .replaceMissing (valuesSource , rawMissing , docValueFormat , nowSupplier );
198
199
}
199
200
200
201
@ Override
@@ -219,8 +220,9 @@ public ValuesSource getField(FieldContext fieldContext, AggregationScript.LeafFa
219
220
}
220
221
221
222
@ Override
222
- public ValuesSource replaceMissing (ValuesSource valuesSource , Object rawMissing , DocValueFormat docValueFormat , LongSupplier now ) {
223
- return NUMERIC .replaceMissing (valuesSource , rawMissing , docValueFormat , now );
223
+ public ValuesSource replaceMissing (ValuesSource valuesSource , Object rawMissing , DocValueFormat docValueFormat ,
224
+ LongSupplier nowSupplier ) {
225
+ return NUMERIC .replaceMissing (valuesSource , rawMissing , docValueFormat , nowSupplier );
224
226
}
225
227
226
228
@ Override
@@ -250,8 +252,9 @@ public ValuesSource getField(FieldContext fieldContext, AggregationScript.LeafFa
250
252
}
251
253
252
254
@ Override
253
- public ValuesSource replaceMissing (ValuesSource valuesSource , Object rawMissing , DocValueFormat docValueFormat , LongSupplier now ) {
254
- return NUMERIC .replaceMissing (valuesSource , rawMissing , docValueFormat , now );
255
+ public ValuesSource replaceMissing (ValuesSource valuesSource , Object rawMissing , DocValueFormat docValueFormat ,
256
+ LongSupplier nowSupplier ) {
257
+ return NUMERIC .replaceMissing (valuesSource , rawMissing , docValueFormat , nowSupplier );
255
258
}
256
259
257
260
@ Override
0 commit comments