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 <[email protected]>
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));
         }

Reply via email to