kbendick commented on code in PR #5305:
URL: https://github.com/apache/iceberg/pull/5305#discussion_r930409314


##########
api/src/main/java/org/apache/iceberg/transforms/Truncate.java:
##########
@@ -394,9 +395,7 @@ public ByteBuffer apply(ByteBuffer value) {
         return null;
       }
 
-      ByteBuffer ret = value.duplicate();
-      ret.limit(Math.min(value.limit(), value.position() + length));
-      return ret;
+      return TruncateUtil.truncateByteBuffer(length, value);

Review Comment:
   There's `BinaryUtil#truncateBinary(ByteBuffer, int)`, but it doesn't exactly 
have the same code as is used here and it does a `Preconditions` check on every 
call to it.
   
   I can try to merge the two implementations in a follow up if we want.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to