Browse Source

Test unrounding half_floats (#70937)

Now that #70653 is merged we can send all kinds of strange values to the
`fields` round trip test for `half_float`.
Nik Everett 4 years ago
parent
commit
bde105bca2

+ 1 - 9
server/src/test/java/org/elasticsearch/index/mapper/HalfFloatFieldMapperTests.java

@@ -8,7 +8,6 @@
 
 package org.elasticsearch.index.mapper;
 
-import org.apache.lucene.document.HalfFloatPoint;
 import org.elasticsearch.common.xcontent.XContentBuilder;
 import org.elasticsearch.index.mapper.NumberFieldMapper.NumberType;
 import org.elasticsearch.index.mapper.NumberFieldTypeTests.OutOfRangeSpec;
@@ -42,13 +41,6 @@ public class HalfFloatFieldMapperTests extends NumberFieldMapperTests {
 
     @Override
     protected Number randomNumber() {
-        /*
-         * The native valueFetcher returns 32 bits of precision but the
-         * doc values fetcher returns 16 bits of precision. To make it
-         * all line up we round here instead of in the fetcher. This bug
-         * is tracked in:
-         * https://github.com/elastic/elasticsearch/issues/70260
-         */
-        return HalfFloatPoint.sortableShortToHalfFloat(HalfFloatPoint.halfFloatToSortableShort(randomFloat()));
+        return randomBoolean() ? randomFloat() : randomDoubleBetween(-65504, 65504, true);
     }
 }