2121import org .apache .paimon .data .AbstractPagedInputView ;
2222import org .apache .paimon .data .AbstractPagedOutputView ;
2323import org .apache .paimon .data .BinaryRow ;
24+ import org .apache .paimon .data .RowHelper ;
2425import org .apache .paimon .io .DataInputView ;
2526import org .apache .paimon .io .DataOutputView ;
2627import org .apache .paimon .memory .MemorySegment ;
@@ -80,19 +81,6 @@ public BinaryRow deserialize(DataInputView source) throws IOException {
8081 return row ;
8182 }
8283
83- /**
84- * Maximum retained reuse buffer size in bytes. Buffers exceeding this cap are eligible for
85- * shrinking when the shrink ratio condition is also met.
86- */
87- private static final int MAX_RETAINED_REUSE_BUFFER_SIZE = 4 * 1024 * 1024 ; // 4MB
88-
89- /**
90- * Shrink ratio. The buffer is reallocated only when its size exceeds {@link
91- * #MAX_RETAINED_REUSE_BUFFER_SIZE} AND is more than {@code SHRINK_RATIO} times the current
92- * record length.
93- */
94- private static final int SHRINK_RATIO = 4 ;
95-
9684 public BinaryRow deserialize (BinaryRow reuse , DataInputView source ) throws IOException {
9785 MemorySegment [] segments = reuse .getSegments ();
9886 checkArgument (
@@ -103,8 +91,8 @@ public BinaryRow deserialize(BinaryRow reuse, DataInputView source) throws IOExc
10391 if (segments == null || segments [0 ].size () < length ) {
10492 // Need a larger buffer
10593 segments = new MemorySegment [] {MemorySegment .wrap (new byte [length ])};
106- } else if (segments [0 ].size () > MAX_RETAINED_REUSE_BUFFER_SIZE
107- && segments [0 ].size () > (long ) length * SHRINK_RATIO ) {
94+ } else if (segments [0 ].size () > RowHelper . MAX_RETAINED_REUSE_BUFFER_SIZE
95+ && segments [0 ].size () > (long ) length * RowHelper . SHRINK_RATIO ) {
10896 segments = new MemorySegment [] {MemorySegment .wrap (new byte [length ])};
10997 }
11098 source .readFully (segments [0 ].getArray (), 0 , length );
0 commit comments