You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ha...@apache.org on 2024/03/07 04:04:19 UTC

(iotdb) branch fix_dprofile_IT created (now 8ea606dff56)

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

haonan pushed a change to branch fix_dprofile_IT
in repository https://gitbox.apache.org/repos/asf/iotdb.git


      at 8ea606dff56 Fix some ignored ITs of udf lib

This branch includes the following new commits:

     new 8ea606dff56 Fix some ignored ITs of udf lib

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(iotdb) 01/01: Fix some ignored ITs of udf lib

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

haonan pushed a commit to branch fix_dprofile_IT
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 8ea606dff5675f1ce3cca81fda210fabab769a14
Author: HTHou <hh...@outlook.com>
AuthorDate: Thu Mar 7 12:03:58 2024 +0800

    Fix some ignored ITs of udf lib
---
 .../org/apache/iotdb/libudf/it/dprofile/DProfileIT.java    | 14 +++++---------
 .../java/org/apache/iotdb/library/dprofile/UDTFSample.java |  2 +-
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/integration-test/src/test/java/org/apache/iotdb/libudf/it/dprofile/DProfileIT.java b/integration-test/src/test/java/org/apache/iotdb/libudf/it/dprofile/DProfileIT.java
index b686766613e..ef1c0c1719f 100644
--- a/integration-test/src/test/java/org/apache/iotdb/libudf/it/dprofile/DProfileIT.java
+++ b/integration-test/src/test/java/org/apache/iotdb/libudf/it/dprofile/DProfileIT.java
@@ -25,7 +25,6 @@ import org.apache.iotdb.itbase.category.LocalStandaloneIT;
 
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 import org.junit.runner.RunWith;
@@ -210,10 +209,9 @@ public class DProfileIT {
     }
   }
 
-  @Ignore // TODO: This test case failed, please check the function implementation
   @Test
-  public void testMad1() {
-    String sqlStr = "select mad(d1.s1) from root.vehicle";
+  public void testTimeliness1() {
+    String sqlStr = "select timeliness(d1.s1) from root.vehicle";
     try (Connection connection = EnvFactory.getEnv().getConnection();
         Statement statement = connection.createStatement()) {
       ResultSet resultSet = statement.executeQuery(sqlStr);
@@ -225,7 +223,7 @@ public class DProfileIT {
   }
 
   @Test
-  public void testMad2() {
+  public void testTimeliness2() {
     String sqlStr = "select timeliness(d2.s2) from root.vehicle";
     try (Connection connection = EnvFactory.getEnv().getConnection();
         Statement statement = connection.createStatement()) {
@@ -498,10 +496,9 @@ public class DProfileIT {
     }
   }
 
-  @Ignore // TODO: This test case failed, please check the function implementation
   @Test
   public void testSample1() {
-    String sqlStr = "select resample(d2.s1, 'method'='reservoir','k'='5') from root.vehicle";
+    String sqlStr = "select sample(d2.s1, 'method'='reservoir','k'='5') from root.vehicle";
     try (Connection connection = EnvFactory.getEnv().getConnection();
         Statement statement = connection.createStatement()) {
       ResultSet resultSet = statement.executeQuery(sqlStr);
@@ -510,10 +507,9 @@ public class DProfileIT {
     }
   }
 
-  @Ignore // TODO: This test case failed, please check the function implementation
   @Test
   public void testsample2() {
-    String sqlStr = "select resample(d1.s2, 'method'='isometric','k'='5') from root.vehicle";
+    String sqlStr = "select sample(d1.s2, 'method'='isometric','k'='5') from root.vehicle";
     try (Connection connection = EnvFactory.getEnv().getConnection();
         Statement statement = connection.createStatement()) {
       ResultSet resultSet = statement.executeQuery(sqlStr);
diff --git a/library-udf/src/main/java/org/apache/iotdb/library/dprofile/UDTFSample.java b/library-udf/src/main/java/org/apache/iotdb/library/dprofile/UDTFSample.java
index 64209bc568c..5f1545c853e 100644
--- a/library-udf/src/main/java/org/apache/iotdb/library/dprofile/UDTFSample.java
+++ b/library-udf/src/main/java/org/apache/iotdb/library/dprofile/UDTFSample.java
@@ -166,7 +166,7 @@ public class UDTFSample implements UDTF {
         }
       } else { // Method.ISOMETRIC
         for (long i = 0; i < this.k; i++) {
-          long j = Math.floorDiv(i * n, k); // avoid intermediate result overflows
+          long j = Math.floorDiv(i * n, (long) k); // avoid intermediate result overflows
           Row row = rowWindow.getRow((int) j);
           Util.putValue(collector, dataType, row.getTime(), Util.getValueAsObject(row));
         }