Skip to content

Commit f0a8ea5

Browse files
authored
Test unrounding half_floats (backport of #70937) (#71247)
Now that #70653 is merged we can send all kinds of strange values to the `fields` round trip test for `half_float`.
1 parent ba3d56f commit f0a8ea5

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

server/src/test/java/org/elasticsearch/index/mapper/HalfFloatFieldMapperTests.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
package org.elasticsearch.index.mapper;
1010

11-
import org.apache.lucene.document.HalfFloatPoint;
1211
import org.elasticsearch.common.xcontent.XContentBuilder;
1312
import org.elasticsearch.index.mapper.NumberFieldMapper.NumberType;
1413
import org.elasticsearch.index.mapper.NumberFieldTypeTests.OutOfRangeSpec;
@@ -43,13 +42,6 @@ protected void minimalMapping(XContentBuilder b) throws IOException {
4342

4443
@Override
4544
protected Number randomNumber() {
46-
/*
47-
* The native valueFetcher returns 32 bits of precision but the
48-
* doc values fetcher returns 16 bits of precision. To make it
49-
* all line up we round here instead of in the fetcher. This bug
50-
* is tracked in:
51-
* https://github.com/elastic/elasticsearch/issues/70260
52-
*/
53-
return HalfFloatPoint.sortableShortToHalfFloat(HalfFloatPoint.halfFloatToSortableShort(randomFloat()));
45+
return randomBoolean() ? randomFloat() : randomDoubleBetween(-65504, 65504, true);
5446
}
5547
}

0 commit comments

Comments
 (0)