diff --git a/core/trino-main/src/test/java/io/trino/operator/aggregation/AggregationTestUtils.java b/core/trino-main/src/test/java/io/trino/operator/aggregation/AggregationTestUtils.java index 9a129fb259e4..92bcfb2aeed8 100644 --- a/core/trino-main/src/test/java/io/trino/operator/aggregation/AggregationTestUtils.java +++ b/core/trino-main/src/test/java/io/trino/operator/aggregation/AggregationTestUtils.java @@ -63,10 +63,10 @@ public static void assertAggregation(TestingFunctionResolution functionResolutio public static BiFunction makeValidityAssertion(Object expectedValue) { if (expectedValue instanceof Double && !expectedValue.equals(Double.NaN)) { - return (actual, expected) -> Precision.equals((double) actual, (double) expected, 1.0e-10); + return (actual, expected) -> actual != null && expected != null && Precision.equals((double) actual, (double) expected, 1.0e-10); } if (expectedValue instanceof Float && !expectedValue.equals(Float.NaN)) { - return (actual, expected) -> Precision.equals((float) actual, (float) expected, 1.0e-10f); + return (actual, expected) -> actual != null && expected != null && Precision.equals((float) actual, (float) expected, 1.0e-10f); } return Objects::equals; }