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

haonan pushed a commit to branch HTHou-patch-1
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit e5acb5d4b6622eb74d444a7d7e6bd4f5f20b5d33
Author: Haonan <[email protected]>
AuthorDate: Tue Mar 25 10:55:50 2025 +0800

    Fix division by zero error when flush memtable
---
 .../org/apache/iotdb/db/utils/datastructure/AlignedTVList.java     | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/AlignedTVList.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/AlignedTVList.java
index 0b9f4d951b0..f379f236290 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/AlignedTVList.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/AlignedTVList.java
@@ -1288,8 +1288,11 @@ public abstract class AlignedTVList extends TVList {
     if (largestBinaryChunkSize == 0) {
       return largestPrimitivePointSize;
     }
-    int avgPointSizeOfLargestBinaryColumn =
-        (int) largestBinaryChunkSize / 
getColumnValueCnt(largestBinaryColumnIndex);
+    int columnValueCnt = getColumnValueCnt(largestBinaryColumnIndex);
+    if (columnValueCnt == 0) {
+      return largestPrimitivePointSize;
+    }
+    int avgPointSizeOfLargestBinaryColumn = (int) largestBinaryChunkSize / 
columnValueCnt;
     return Math.max(avgPointSizeOfLargestBinaryColumn, 
largestPrimitivePointSize);
   }
 

Reply via email to