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

lzljs3620320 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git


The following commit(s) were added to refs/heads/master by this push:
     new 28ac31afc6 [core] Optimize DataFileMeta.keyStats to EMPTY_STATS to 
reduce memory usage (#5718)
28ac31afc6 is described below

commit 28ac31afc6f4bb005bf0ec74304a1fadf0d736e6
Author: Jingsong Lee <[email protected]>
AuthorDate: Mon Jun 9 12:59:11 2025 +0800

    [core] Optimize DataFileMeta.keyStats to EMPTY_STATS to reduce memory usage 
(#5718)
---
 .../src/main/java/org/apache/paimon/stats/SimpleStats.java | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/paimon-core/src/main/java/org/apache/paimon/stats/SimpleStats.java 
b/paimon-core/src/main/java/org/apache/paimon/stats/SimpleStats.java
index 62ad8577a4..7dc5be5e96 100644
--- a/paimon-core/src/main/java/org/apache/paimon/stats/SimpleStats.java
+++ b/paimon-core/src/main/java/org/apache/paimon/stats/SimpleStats.java
@@ -22,6 +22,7 @@ import org.apache.paimon.annotation.Public;
 import org.apache.paimon.data.BinaryArray;
 import org.apache.paimon.data.BinaryRow;
 import org.apache.paimon.data.GenericRow;
+import org.apache.paimon.data.InternalArray;
 import org.apache.paimon.data.InternalRow;
 import org.apache.paimon.types.ArrayType;
 import org.apache.paimon.types.BigIntType;
@@ -93,10 +94,15 @@ public class SimpleStats {
     }
 
     public static SimpleStats fromRow(InternalRow row) {
-        return new SimpleStats(
-                deserializeBinaryRow(row.getBinary(0)),
-                deserializeBinaryRow(row.getBinary(1)),
-                BinaryArray.fromLongArray(row.getArray(2)));
+        BinaryRow minValues = deserializeBinaryRow(row.getBinary(0));
+        BinaryRow maxValues = deserializeBinaryRow(row.getBinary(1));
+        InternalArray nullCounts = row.getArray(2);
+        if (minValues.getFieldCount() == 0
+                && maxValues.getFieldCount() == 0
+                && nullCounts.size() == 0) {
+            return EMPTY_STATS;
+        }
+        return new SimpleStats(minValues, maxValues, 
BinaryArray.fromLongArray(nullCounts));
     }
 
     @Override

Reply via email to