Fix half-float range in SupportedTypeTests (#55409)
Also adds a comment to the half-float number field type tests indicating why 70000 is used instead of 65504
This commit is contained in:
parent
e74fdacabd
commit
4f483ac370
|
@ -347,6 +347,8 @@ public class NumberFieldTypeTests extends FieldTypeTestCase {
|
|||
final int numDocs = 10000;
|
||||
for (int i = 0; i < numDocs; ++i) {
|
||||
Document doc = new Document();
|
||||
// Note: this test purposefully allows half-floats to be indexed over their dynamic range (65504), which
|
||||
// ends up being rounded to Infinity by halfFloatToSortableShort()
|
||||
float value = (randomFloat() * 2 - 1) * 70000;
|
||||
float rounded = HalfFloatPoint.sortableShortToHalfFloat(HalfFloatPoint.halfFloatToSortableShort(value));
|
||||
doc.add(new HalfFloatPoint("half_float", value));
|
||||
|
|
|
@ -217,10 +217,4 @@ public class SignificantTextAggregatorTests extends AggregatorTestCase {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/55360")
|
||||
@Override
|
||||
public void testSupportedFieldTypes() throws IOException {
|
||||
super.testSupportedFieldTypes();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -125,10 +125,4 @@ public class HDRPercentileRanksAggregatorTests extends AggregatorTestCase {
|
|||
|
||||
assertThat(e.getMessage(), Matchers.equalTo("[values] must not be an empty array: [my_agg]"));
|
||||
}
|
||||
|
||||
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/55360")
|
||||
@Override
|
||||
public void testSupportedFieldTypes() throws IOException {
|
||||
super.testSupportedFieldTypes();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -225,10 +225,4 @@ public class HDRPercentilesAggregatorTests extends AggregatorTestCase {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/55360")
|
||||
@Override
|
||||
public void testSupportedFieldTypes() throws IOException {
|
||||
super.testSupportedFieldTypes();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -283,12 +283,6 @@ public class MedianAbsoluteDeviationAggregatorTests extends AggregatorTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/55360")
|
||||
@Override
|
||||
public void testSupportedFieldTypes() throws IOException {
|
||||
super.testSupportedFieldTypes();
|
||||
}
|
||||
|
||||
public static class IsCloseToRelative extends TypeSafeMatcher<Double> {
|
||||
|
||||
private final double expected;
|
||||
|
|
|
@ -725,8 +725,8 @@ public abstract class AggregatorTestCase extends ESTestCase {
|
|||
v = NumericUtils.floatToSortableInt(f);
|
||||
json = "{ \"" + fieldName + "\" : \"" + f + "\" }";
|
||||
} else if (typeName.equals(NumberFieldMapper.NumberType.HALF_FLOAT.typeName())) {
|
||||
// Respect half float range
|
||||
float f = Math.abs((randomFloat() * 2 - 1) * 70000);
|
||||
// Generate a random float that respects the limits of half float
|
||||
float f = Math.abs((randomFloat() * 2 - 1) * 65504);
|
||||
v = HalfFloatPoint.halfFloatToSortableShort(f);
|
||||
json = "{ \"" + fieldName + "\" : \"" + f + "\" }";
|
||||
} else {
|
||||
|
|
|
@ -109,10 +109,4 @@ public class HDRPreAggregatedPercentileRanksAggregatorTests extends AggregatorTe
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/55360")
|
||||
@Override
|
||||
public void testSupportedFieldTypes() throws IOException {
|
||||
super.testSupportedFieldTypes();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -158,10 +158,4 @@ public class HDRPreAggregatedPercentilesAggregatorTests extends AggregatorTestCa
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/55360")
|
||||
@Override
|
||||
public void testSupportedFieldTypes() throws IOException {
|
||||
super.testSupportedFieldTypes();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue