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

leirui pushed a commit to branch research/LTS-visualization
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 2bbad3f46a3efe6efd8f85661cad97e8c29767e0
Author: Lei Rui <[email protected]>
AuthorDate: Tue Jan 30 00:19:22 2024 +0800

    add
---
 .../groupby/LocalGroupByExecutorTri_ILTS.java      |  7 ++-
 .../groupby/LocalGroupByExecutorTri_LTTB.java      |  3 ++
 .../iotdb/db/integration/tri/MyTest_ILTS.java      | 60 ++++++++++++++++++++++
 3 files changed, 68 insertions(+), 2 deletions(-)

diff --git 
a/server/src/main/java/org/apache/iotdb/db/query/dataset/groupby/LocalGroupByExecutorTri_ILTS.java
 
b/server/src/main/java/org/apache/iotdb/db/query/dataset/groupby/LocalGroupByExecutorTri_ILTS.java
index 0f0f324d335..23b2ff9ee5d 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/query/dataset/groupby/LocalGroupByExecutorTri_ILTS.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/query/dataset/groupby/LocalGroupByExecutorTri_ILTS.java
@@ -195,6 +195,9 @@ public class LocalGroupByExecutorTri_ILTS implements 
GroupByExecutor {
           if (num == 0) { // 是第一次迭代的话,就使用右边桶的平均点
             // ========计算右边桶的平均点========
             List<ChunkSuit4Tri> chunkSuit4TriList = splitChunkList.get(b + 1);
+            if (chunkSuit4TriList == null) {
+              throw new IOException("Empty bucket!");
+            }
             long rightStartTime = startTime + (b + 1) * interval;
             long rightEndTime = startTime + (b + 2) * interval;
             int cnt = 0;
@@ -319,8 +322,8 @@ public class LocalGroupByExecutorTri_ILTS implements 
GroupByExecutor {
             //   
如果这个上限是maxDistance,在“用元数据点/紧致下限更新maxDistance&select_t&select_v”
             //   步骤中已经赋值了这个边点,所以这里跳过没关系)
             if (chunkSuit4Tri.distance_loose_upper_bound <= maxDistance) {
-              //              System.out.println("skip" + b + "," +
-              // chunkSuit4Tri.chunkMetadata.getStartTime());
+              //                            System.out.println("skip" + b + 
"," +
+              //               chunkSuit4Tri.chunkMetadata.getStartTime());
               continue;
             }
           }
diff --git 
a/server/src/main/java/org/apache/iotdb/db/query/dataset/groupby/LocalGroupByExecutorTri_LTTB.java
 
b/server/src/main/java/org/apache/iotdb/db/query/dataset/groupby/LocalGroupByExecutorTri_LTTB.java
index 474ae0330e3..8898287f013 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/query/dataset/groupby/LocalGroupByExecutorTri_LTTB.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/query/dataset/groupby/LocalGroupByExecutorTri_LTTB.java
@@ -175,6 +175,9 @@ public class LocalGroupByExecutorTri_LTTB implements 
GroupByExecutor {
       } else {
         // 计算右边桶的平均点
         List<ChunkSuit4Tri> chunkSuit4TriList = splitChunkList.get(b + 1);
+        if (chunkSuit4TriList == null) {
+          throw new IOException("Empty bucket!");
+        }
         long rightStartTime = startTime + (b + 1) * interval;
         long rightEndTime = startTime + (b + 2) * interval;
         int cnt = 0;
diff --git 
a/server/src/test/java/org/apache/iotdb/db/integration/tri/MyTest_ILTS.java 
b/server/src/test/java/org/apache/iotdb/db/integration/tri/MyTest_ILTS.java
index 59bf45b5c82..7889107f8fd 100644
--- a/server/src/test/java/org/apache/iotdb/db/integration/tri/MyTest_ILTS.java
+++ b/server/src/test/java/org/apache/iotdb/db/integration/tri/MyTest_ILTS.java
@@ -316,4 +316,64 @@ public class MyTest_ILTS {
       e.printStackTrace();
     }
   }
+
+  //  @Test
+  //  public void test3() {
+  //    prepareData3();
+  //    config.setNumIterations(1); // result equals LTTB
+  //    String res = 
"5.0[1],10.0[2],2.0[40],15.0[60],18.0[70],1.0[90],7.0[102],";
+  //    try (Connection connection =
+  //        DriverManager.getConnection("jdbc:iotdb://127.0.0.1:6667/", 
"root", "root");
+  //        Statement statement = connection.createStatement()) {
+  //      boolean hasResultSet =
+  //          statement.execute(
+  //              "SELECT min_value(s0)"
+  //                  // TODO not real min_value here, actually controlled by 
enableTri
+  //                  + ",max_value(s0),min_time(s0), max_time(s0), 
first_value(s0), last_value(s0)"
+  //                  + " FROM root.vehicle.d0 group by ([1,100),50ms)");
+  //      // (102-2)/(7-2)=20ms
+  //      // note keep no empty buckets
+  //
+  //      Assert.assertTrue(hasResultSet);
+  //      try (ResultSet resultSet = statement.getResultSet()) {
+  //        int i = 0;
+  //        while (resultSet.next()) {
+  //          String ans = resultSet.getString(2);
+  //          System.out.println(ans);
+  ////          Assert.assertEquals(res, ans);
+  //        }
+  //      }
+  //    } catch (Exception e) {
+  //      e.printStackTrace();
+  //      fail(e.getMessage());
+  //    }
+  //  }
+  //
+  //  private static void prepareData3() {
+  //    try (Connection connection =
+  //        DriverManager.getConnection(
+  //            Config.IOTDB_URL_PREFIX + "127.0.0.1:6667/", "root", "root");
+  //        Statement statement = connection.createStatement()) {
+  //
+  //      for (String sql : creationSqls) {
+  //        statement.execute(sql);
+  //      }
+  //
+  //      config.setP1t(0);
+  //      config.setP1v(0);
+  //      config.setPnt(100);
+  //      config.setPnv(100);
+  //
+  //      for (int i = 0; i < 100; i++) {
+  //        // linear
+  //        statement.execute(String.format(Locale.ENGLISH, insertTemplate, i 
+ 1, i + 1.0));
+  //        if ((i + 1) % 4 == 0) {
+  //          statement.execute("FLUSH");
+  //        }
+  //      }
+  //      statement.execute("FLUSH");
+  //    } catch (Exception e) {
+  //      e.printStackTrace();
+  //    }
+  //  }
 }

Reply via email to