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 b818506d5b7df505f94e2f89be3d3c53d085446d
Author: Lei Rui <[email protected]>
AuthorDate: Mon Oct 7 00:36:42 2024 +0800

    add
---
 .../java/org/apache/iotdb/db/query/udf/builtin/UDTFM4MAC.java     | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/server/src/main/java/org/apache/iotdb/db/query/udf/builtin/UDTFM4MAC.java 
b/server/src/main/java/org/apache/iotdb/db/query/udf/builtin/UDTFM4MAC.java
index 02c38940010..800807d334c 100644
--- a/server/src/main/java/org/apache/iotdb/db/query/udf/builtin/UDTFM4MAC.java
+++ b/server/src/main/java/org/apache/iotdb/db/query/udf/builtin/UDTFM4MAC.java
@@ -159,7 +159,7 @@ public class UDTFM4MAC implements UDTF {
   }
 
   protected void transformInt(long time, int value) throws IOException {
-    double intervalLen = (tqe - tqs) * 1.0 / w;
+    long intervalLen = (tqe - tqs) / w; // consistent with MinMaxCache's 
strategy
     int pos = (int) Math.floor((time - tqs) * 1.0 / intervalLen);
     if (pos >= w) {
       throw new IOException("Make sure the range time filter is time>=tqs and 
time<tqe");
@@ -210,7 +210,7 @@ public class UDTFM4MAC implements UDTF {
   }
 
   protected void transformLong(long time, long value) throws IOException {
-    double intervalLen = (tqe - tqs) * 1.0 / w;
+    long intervalLen = (tqe - tqs) / w; // consistent with MinMaxCache's 
strategy
     int pos = (int) Math.floor((time - tqs) * 1.0 / intervalLen);
 
     if (pos >= w) {
@@ -261,7 +261,7 @@ public class UDTFM4MAC implements UDTF {
   }
 
   protected void transformFloat(long time, float value) throws IOException {
-    double intervalLen = (tqe - tqs) * 1.0 / w;
+    long intervalLen = (tqe - tqs) / w; // consistent with MinMaxCache's 
strategy
     int pos = (int) Math.floor((time - tqs) * 1.0 / intervalLen);
 
     if (pos >= w) {
@@ -312,7 +312,7 @@ public class UDTFM4MAC implements UDTF {
   }
 
   protected void transformDouble(long time, double value) throws IOException {
-    double intervalLen = (tqe - tqs) * 1.0 / w;
+    long intervalLen = (tqe - tqs) / w; // consistent with MinMaxCache's 
strategy
     int pos = (int) Math.floor((time - tqs) * 1.0 / intervalLen);
 
     if (pos >= w) {

Reply via email to