This is an automated email from the ASF dual-hosted git repository.

xiangfu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new f1b9280c0dc Use standard double comparison with delta in tests (#17074)
f1b9280c0dc is described below

commit f1b9280c0dc7e4919df2456eea7d658a8f0bf768
Author: Yash Mayya <[email protected]>
AuthorDate: Mon Oct 27 14:48:34 2025 -0700

    Use standard double comparison with delta in tests (#17074)
---
 .../pinot/core/util/DoubleComparisonUtil.java      | 48 ----------------------
 .../pinot/integration/tests/custom/ArrayTest.java  |  7 ++--
 2 files changed, 3 insertions(+), 52 deletions(-)

diff --git 
a/pinot-core/src/test/java/org/apache/pinot/core/util/DoubleComparisonUtil.java 
b/pinot-core/src/test/java/org/apache/pinot/core/util/DoubleComparisonUtil.java
deleted file mode 100644
index 24baec6be9f..00000000000
--- 
a/pinot-core/src/test/java/org/apache/pinot/core/util/DoubleComparisonUtil.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pinot.core.util;
-
-public class DoubleComparisonUtil {
-  private DoubleComparisonUtil() {
-  }
-
-  private static final double DEFAULT_EPSILON = 0.000001;
-
-  public static int defaultDoubleCompare(double d1, double d2) {
-    return doubleCompare(d1, d2, DEFAULT_EPSILON);
-  }
-
-  public static int doubleCompare(double d1, double d2, double epsilon) {
-    if (d1 > d2) {
-      if (d1 * (1 - epsilon) > d2) {
-        return 1;
-      } else {
-        return 0;
-      }
-    }
-    if (d2 > d1) {
-      if (d2 * (1 - epsilon) > d1) {
-        return -1;
-      } else {
-        return 0;
-      }
-    }
-    return 0;
-  }
-}
diff --git 
a/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/custom/ArrayTest.java
 
b/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/custom/ArrayTest.java
index ebba6db88bd..9b36998e6f7 100644
--- 
a/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/custom/ArrayTest.java
+++ 
b/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/custom/ArrayTest.java
@@ -28,7 +28,6 @@ import org.apache.avro.file.DataFileWriter;
 import org.apache.avro.generic.GenericData;
 import org.apache.avro.generic.GenericDatumWriter;
 import org.apache.commons.lang3.RandomStringUtils;
-import org.apache.pinot.core.util.DoubleComparisonUtil;
 import org.apache.pinot.spi.data.FieldSpec;
 import org.apache.pinot.spi.data.Schema;
 import org.testng.annotations.Test;
@@ -511,9 +510,9 @@ public class ArrayTest extends 
CustomDataQueryClusterIntegrationTest {
     assertEquals(entry1.size(), 4);
     assertEquals(entry1.get(0).doubleValue(), 0.0);
     // Compare double values:
-    
assertEquals(DoubleComparisonUtil.defaultDoubleCompare(entry1.get(1).doubleValue(),
 100.0), 0);
-    
assertEquals(DoubleComparisonUtil.defaultDoubleCompare(entry1.get(2).doubleValue(),
 200.0), 0);
-    
assertEquals(DoubleComparisonUtil.defaultDoubleCompare(entry1.get(3).doubleValue(),
 300.0), 0);
+    assertEquals(entry1.get(1).doubleValue(), 100.0, 0.000001);
+    assertEquals(entry1.get(2).doubleValue(), 200.0, 0.000001);
+    assertEquals(entry1.get(3).doubleValue(), 300.0, 0.000001);
   }
 
   @Test(dataProvider = "useBothQueryEngines")


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to