You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ro...@apache.org on 2022/01/18 09:37:43 UTC

[iotdb] 01/01: [IOTDB-2434] IT fails on IoTDBContinuousQueryIT caused by double precision loss

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

rong pushed a commit to branch iotdb-2434
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit ba830876466e8b95bb4c4db95026c83885a1b149
Author: Steve Yurong Su <ro...@apache.org>
AuthorDate: Tue Jan 18 17:36:49 2022 +0800

    [IOTDB-2434] IT fails on IoTDBContinuousQueryIT caused by double precision loss
---
 .../db/integration/IoTDBContinuousQueryIT.java      | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBContinuousQueryIT.java b/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBContinuousQueryIT.java
index 9dcc99e..ee11e89 100644
--- a/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBContinuousQueryIT.java
+++ b/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBContinuousQueryIT.java
@@ -404,7 +404,7 @@ public class IoTDBContinuousQueryIT {
     }
 
     long waitMillSeconds = 0;
-    List<Pair<Long, String>> actualResult;
+    List<Pair<Long, Double>> actualResult;
     do {
       Thread.sleep(waitMillSeconds);
       waitMillSeconds += 100;
@@ -419,18 +419,25 @@ public class IoTDBContinuousQueryIT {
         String.format(
             "select avg(temperature) from root.ln.wf01.*.* GROUP BY ([%d, %d), %dms), level=1,2 without null all",
             actualWindowBegin, actualWindowEnd + groupByInterval, groupByInterval));
-    List<Pair<Long, String>> expectedResult = collectQueryResult();
-
-    assertEquals(expectedResult, actualResult);
+    List<Pair<Long, Double>> expectedResult = collectQueryResult();
+
+    assertEquals(expectedResult.size(), actualResult.size());
+    final int size = expectedResult.size();
+    for (int i = 0; i < size; ++i) {
+      Pair<Long, Double> expected = expectedResult.get(i);
+      Pair<Long, Double> actual = actualResult.get(i);
+      assertEquals(expected.left, actual.left);
+      assertEquals(expected.right, actual.right, 10e-6);
+    }
   }
 
-  private List<Pair<Long, String>> collectQueryResult() {
-    List<Pair<Long, String>> result = new ArrayList<>();
+  private List<Pair<Long, Double>> collectQueryResult() {
+    List<Pair<Long, Double>> result = new ArrayList<>();
     try (ResultSet resultSet = statement.getResultSet()) {
       while (resultSet.next()) {
         String timestamp = resultSet.getString(1);
         String value = resultSet.getString(2);
-        result.add(new Pair<>(Long.parseLong(timestamp), value));
+        result.add(new Pair<>(Long.parseLong(timestamp), Double.parseDouble(value)));
       }
     } catch (SQLException throwable) {
       fail(throwable.getMessage());