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

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

commit 3137b42cdfc00b95a9a0e0c2e1cbcc97ba6f568e
Author: Lei Rui <[email protected]>
AuthorDate: Fri Jan 27 17:38:16 2023 +0800

    fix bug
---
 .../iotdb/tsfile/file/metadata/statistics/StepRegress.java    | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git 
a/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/statistics/StepRegress.java
 
b/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/statistics/StepRegress.java
index ec981bd760..d75375d960 100644
--- 
a/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/statistics/StepRegress.java
+++ 
b/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/statistics/StepRegress.java
@@ -241,7 +241,10 @@ public class StepRegress {
               this.segmentIntercepts = new DoubleArrayList();
               this.segmentKeys.add(timestamps.get(0)); // t1
               this.segmentIntercepts.add(1 - slope * timestamps.get(0)); // b1
-            } else if (start < segmentIntercepts.size() - 3) {
+            } else if ((start < segmentIntercepts.size() - 3) || equals) {
+              // either the first tilt intercept which is not smaller than the 
last tilt intercept
+              // is not the second-to-last tilt intercept,
+              // or is the second-to-last tilt intercept but is equal to the 
last tilt intercept.
               if (!equals) {
                 // remove all segment information after start+1 id, i.e., 
remove from start+2~end
                 // note that the level after start tilt is kept since 
equals=false.
@@ -273,8 +276,10 @@ public class StepRegress {
                 // TODO debug the first status is level, b1
               }
             }
-            // otherwise start==segmentIntercepts.size()-3 means result is 
already ready, no
-            // disorder to handle
+            // otherwise start==segmentIntercepts.size()-3 && equal=false,
+            // means the first tilt intercept which is bigger than the last 
tilt intercept
+            // is the second-to-last tilt intercept,
+            // so in this case the result is already ready, no disorder to 
handle
           }
         }
       }

Reply via email to