JingsongLi commented on code in PR #382:
URL: https://github.com/apache/flink-table-store/pull/382#discussion_r1023442925


##########
flink-table-store-core/src/main/java/org/apache/flink/table/store/file/stats/BinaryTableStats.java:
##########
@@ -73,27 +74,40 @@ public FieldStats[] fields(FieldStatsArraySerializer 
converter, @Nullable Long r
     }
 
     public BinaryRowData min() {
-        return min;
+        if (cacheMin == null) {
+            checkNotNull(row);
+            cacheMin = deserializeBinaryRow(this.row.getBinary(0));
+        }
+        return cacheMin;
     }
 
     public BinaryRowData max() {
-        return max;
+        if (cacheMax == null) {
+            checkNotNull(row);
+            cacheMax = deserializeBinaryRow(this.row.getBinary(1));
+        }
+        return cacheMax;
     }
 
     public long[] nullCounts() {
-        return nullCounts;
+        if (cacheNullCounts == null) {
+            checkNotNull(row);
+            cacheNullCounts = row.getArray(2).toLongArray();
+        }
+        return cacheNullCounts;
     }
 
     public RowData toRowData() {
-        return GenericRowData.of(
-                serializeBinaryRow(min), serializeBinaryRow(max), new 
GenericArrayData(nullCounts));
+        return row == null
+                ? GenericRowData.of(
+                        serializeBinaryRow(min()),
+                        serializeBinaryRow(max()),
+                        new GenericArrayData(nullCounts()))
+                : GenericRowData.of(row.getBinary(0), row.getBinary(1), 
row.getArray(2));

Review Comment:
   Why not just return row?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to