Skip to content

Commit 0ba0375

Browse files
Prevent scaledFloat test from using too small scale factors (#112583)
Scale factors less than about 5.6e-309 will result in NaN (due to 1/scaleFactor being infinity). We could fix this better, by detecting that the scaled result of 0 can never be scaled back to any original value other than 0 itself (due to irretrievable loss of precision). That would require making a simple conditional check in about three places in the ScaledFloatFieldMapper class where the scaling-back is done. But as a quick fix, we just avoid this case in the tests for now. Co-authored-by: Elastic Machine <[email protected]>
1 parent 6ddc163 commit 0ba0375

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

muted-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,6 @@ tests:
101101
- class: org.elasticsearch.xpack.restart.CoreFullClusterRestartIT
102102
method: testSnapshotRestore {cluster=UPGRADED}
103103
issue: https://github.com/elastic/elasticsearch/issues/111799
104-
- class: org.elasticsearch.xpack.esql.qa.mixed.FieldExtractorIT
105-
method: testScaledFloat
106-
issue: https://github.com/elastic/elasticsearch/issues/112003
107104
- class: org.elasticsearch.xpack.inference.InferenceRestIT
108105
method: test {p0=inference/80_random_rerank_retriever/Random rerank retriever predictably shuffles results}
109106
issue: https://github.com/elastic/elasticsearch/issues/111999

x-pack/plugin/esql/qa/server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/FieldExtractorTestCase.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,8 @@ public void testFloat() throws IOException {
220220

221221
public void testScaledFloat() throws IOException {
222222
double value = randomBoolean() ? randomDoubleBetween(-Double.MAX_VALUE, Double.MAX_VALUE, true) : randomFloat();
223-
double scalingFactor = randomDoubleBetween(0, Double.MAX_VALUE, false);
223+
// Scale factors less than about 5.6e-309 will result in NaN (due to 1/scaleFactor being infinity)
224+
double scalingFactor = randomDoubleBetween(1e-308, Double.MAX_VALUE, false);
224225
new Test("scaled_float").expectedType("double")
225226
.randomIgnoreMalformedUnlessSynthetic()
226227
.randomDocValuesUnlessSynthetic()

0 commit comments

Comments
 (0)