Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions muted-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -441,18 +441,12 @@ tests:
- class: org.elasticsearch.xpack.esql.qa.single_node.GenerativeForkIT
method: test {csv-spec:spatial_shapes.ConvertFromStringParseError}
issue: https://github.com/elastic/elasticsearch/issues/134254
- class: org.elasticsearch.xpack.esql.expression.function.scalar.score.DecayTests
method: "testEvaluateBlockWithNulls {TestCase=<double>, <double>, <double>, <_source> #11}"
issue: https://github.com/elastic/elasticsearch/issues/134447
- class: org.elasticsearch.action.admin.cluster.state.TransportClusterStateActionTests
method: testGetClusterStateWithDefaultProjectOnly
issue: https://github.com/elastic/elasticsearch/issues/134450
- class: org.elasticsearch.cluster.ClusterInfoServiceIT
method: testMaxQueueLatenciesInClusterInfo
issue: https://github.com/elastic/elasticsearch/issues/134500
- class: org.elasticsearch.xpack.esql.expression.function.scalar.score.DecayTests
method: "testEvaluateBlockWithNulls {TestCase=<date_nanos>, <date_nanos>, <time_duration>, <_source> #11}"
issue: https://github.com/elastic/elasticsearch/issues/134509
- class: org.elasticsearch.xpack.esql.plugin.CanMatchIT
method: testAliasFilters
issue: https://github.com/elastic/elasticsearch/issues/134512
Expand All @@ -477,9 +471,6 @@ tests:
- class: org.elasticsearch.aggregations.bucket.AggregationReductionCircuitBreakingIT
method: testCBTrippingOnReduction
issue: https://github.com/elastic/elasticsearch/issues/134667
- class: org.elasticsearch.xpack.esql.expression.function.scalar.score.DecayTests
method: "testEvaluateBlockWithNulls {TestCase=<integer>, <integer>, <integer>, <_source> #2}"
issue: https://github.com/elastic/elasticsearch/issues/134679
- class: org.elasticsearch.xpack.esql.ccq.MultiClusterSpecIT
method: test {csv-spec:fork.ForkBeforeStatsByWithWhere}
issue: https://github.com/elastic/elasticsearch/issues/134817
Expand Down Expand Up @@ -531,12 +522,6 @@ tests:
- class: org.elasticsearch.search.sort.FieldSortIT
method: testSortMixedFieldTypes
issue: https://github.com/elastic/elasticsearch/issues/129445
- class: org.elasticsearch.xpack.esql.expression.function.scalar.score.DecayTests
method: "testEvaluateInManyThreads {TestCase=<double>, <double>, <double>, <_source> #17}"
issue: https://github.com/elastic/elasticsearch/issues/135357
- class: org.elasticsearch.xpack.esql.expression.function.scalar.score.DecayTests
method: "testEvaluateBlockWithoutNulls {TestCase=<date_nanos>, <date_nanos>, <time_duration>, <_source> #12}"
issue: https://github.com/elastic/elasticsearch/issues/135394
- class: org.elasticsearch.gradle.TestClustersPluginFuncTest
method: override jdk usage via ES_JAVA_HOME for known jdk os incompatibilities
issue: https://github.com/elastic/elasticsearch/issues/135413
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@
import org.elasticsearch.xpack.esql.core.type.DataType;
import org.elasticsearch.xpack.esql.expression.function.AbstractScalarFunctionTestCase;
import org.elasticsearch.xpack.esql.expression.function.TestCaseSupplier;
import org.hamcrest.Matcher;
import org.junit.BeforeClass;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.Duration;
import java.time.Instant;
import java.time.LocalDateTime;
Expand Down Expand Up @@ -666,7 +669,7 @@ private static List<TestCaseSupplier> intRandomTestCases() {
),
startsWith("DecayIntEvaluator["),
DataType.DOUBLE,
closeTo(scoreScriptNumericResult, Math.ulp(scoreScriptNumericResult))
decayValueMatcher(scoreScriptNumericResult)
);
}));
}
Expand Down Expand Up @@ -740,7 +743,7 @@ private static List<TestCaseSupplier> longRandomTestCases() {
),
startsWith("DecayLongEvaluator["),
DataType.DOUBLE,
equalTo(scoreScriptNumericResult)
decayValueMatcher(scoreScriptNumericResult)
);
}));
}
Expand Down Expand Up @@ -810,7 +813,7 @@ private static List<TestCaseSupplier> doubleRandomTestCases() {
),
startsWith("DecayDoubleEvaluator["),
DataType.DOUBLE,
closeTo(scoreScriptNumericResult, Math.ulp(scoreScriptNumericResult))
decayValueMatcher(scoreScriptNumericResult)
);
}));
}
Expand Down Expand Up @@ -908,7 +911,7 @@ private static List<TestCaseSupplier> geoPointRandomTestCases() {
),
startsWith("DecayGeoPointEvaluator["),
DataType.DOUBLE,
closeTo(scoreScriptNumericResult, Math.ulp(scoreScriptNumericResult))
decayValueMatcher(scoreScriptNumericResult)
);
}));
}
Expand Down Expand Up @@ -1087,7 +1090,7 @@ private static List<TestCaseSupplier> datetimeRandomTestCases() {
),
startsWith("DecayDatetimeEvaluator["),
DataType.DOUBLE,
closeTo(scoreScriptNumericResult, Math.ulp(scoreScriptNumericResult))
decayValueMatcher(scoreScriptNumericResult)
);
}));
}
Expand Down Expand Up @@ -1174,7 +1177,7 @@ private static List<TestCaseSupplier> dateNanosRandomTestCases() {
),
startsWith("DecayDateNanosEvaluator["),
DataType.DOUBLE,
closeTo(scoreScriptNumericResult, 1e-10)
decayValueMatcher(scoreScriptNumericResult)
);
})
);
Expand Down Expand Up @@ -1229,4 +1232,12 @@ private static MapExpression createOptionsMap(Object offset, Double decay, Strin

return new MapExpression(Source.EMPTY, keyValuePairs);
}

private static Matcher<Double> decayValueMatcher(Double value) {
if (value == Double.POSITIVE_INFINITY || value == Double.NEGATIVE_INFINITY) {
return equalTo(value);
}

return closeTo(BigDecimal.valueOf(value).setScale(4, RoundingMode.CEILING).doubleValue(), 0.001);
}
}