@@ -57,7 +57,6 @@ public ValuesSource getScript(AggregationScript.LeafFactory script, ValueType sc
5757 public ValuesSource getField (FieldContext fieldContext , AggregationScript .LeafFactory script ) {
5858
5959 if ((fieldContext .indexFieldData () instanceof IndexNumericFieldData ) == false ) {
60- // TODO: Is this the correct exception type here?
6160 throw new IllegalArgumentException ("Expected numeric type on field [" + fieldContext .field () +
6261 "], but got [" + fieldContext .fieldType ().typeName () + "]" );
6362 }
@@ -71,8 +70,9 @@ public ValuesSource getField(FieldContext fieldContext, AggregationScript.LeafFa
7170 }
7271
7372 @ 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 );
7676 return MissingValues .replaceMissing ((ValuesSource .Numeric ) valuesSource , missing );
7777 }
7878 },
@@ -104,7 +104,8 @@ public ValuesSource getField(FieldContext fieldContext, AggregationScript.LeafFa
104104 }
105105
106106 @ 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 ) {
108109 final BytesRef missing = docValueFormat .parseBytesRef (rawMissing .toString ());
109110 if (valuesSource instanceof ValuesSource .Bytes .WithOrdinals ) {
110111 return MissingValues .replaceMissing ((ValuesSource .Bytes .WithOrdinals ) valuesSource , missing );
@@ -127,7 +128,6 @@ public ValuesSource getScript(AggregationScript.LeafFactory script, ValueType sc
127128 @ Override
128129 public ValuesSource getField (FieldContext fieldContext , AggregationScript .LeafFactory script ) {
129130 if (!(fieldContext .indexFieldData () instanceof IndexGeoPointFieldData )) {
130- // TODO: Is this the correct exception type here?
131131 throw new IllegalArgumentException ("Expected geo_point type on field [" + fieldContext .field () +
132132 "], but got [" + fieldContext .fieldType ().typeName () + "]" );
133133 }
@@ -136,7 +136,8 @@ public ValuesSource getField(FieldContext fieldContext, AggregationScript.LeafFa
136136 }
137137
138138 @ 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 ) {
140141 // TODO: also support the structured formats of geo points
141142 final GeoPoint missing = new GeoPoint (rawMissing .toString ());
142143 return MissingValues .replaceMissing ((ValuesSource .GeoPoint ) valuesSource , missing );
@@ -150,7 +151,6 @@ public DocValueFormat getFormatter(String format, ZoneId tz) {
150151 RANGE () {
151152 @ Override
152153 public ValuesSource getEmpty () {
153- // TODO: Is this the correct exception type here?
154154 throw new IllegalArgumentException ("Can't deal with unmapped ValuesSource type " + this .value ());
155155 }
156156
@@ -164,15 +164,15 @@ public ValuesSource getField(FieldContext fieldContext, AggregationScript.LeafFa
164164 MappedFieldType fieldType = fieldContext .fieldType ();
165165
166166 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 ());
169168 }
170169 RangeFieldMapper .RangeFieldType rangeFieldType = (RangeFieldMapper .RangeFieldType ) fieldType ;
171170 return new ValuesSource .Range (fieldContext .indexFieldData (), rangeFieldType .rangeType ());
172171 }
173172
174173 @ 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 ) {
176176 throw new IllegalArgumentException ("Can't apply missing values on a " + valuesSource .getClass ());
177177 }
178178 },
@@ -193,8 +193,9 @@ public ValuesSource getField(FieldContext fieldContext, AggregationScript.LeafFa
193193 }
194194
195195 @ 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 );
198199 }
199200
200201 @ Override
@@ -219,8 +220,9 @@ public ValuesSource getField(FieldContext fieldContext, AggregationScript.LeafFa
219220 }
220221
221222 @ 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 );
224226 }
225227
226228 @ Override
@@ -250,8 +252,9 @@ public ValuesSource getField(FieldContext fieldContext, AggregationScript.LeafFa
250252 }
251253
252254 @ 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 );
255258 }
256259
257260 @ Override
0 commit comments