Skip to content

Commit cbcc6b1

Browse files
committed
Test unrounding half_floats
Now that elastic#70653 is merged we can send all kinds of strange values to the `fields` round trip test for `half_float`.
1 parent 76448ec commit cbcc6b1

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;
@@ -42,13 +41,6 @@ protected void minimalMapping(XContentBuilder b) throws IOException {
4241

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

0 commit comments

Comments
 (0)