wuwenchi opened a new pull request, #4725:
URL: https://github.com/apache/iceberg/pull/4725

   In fact, truncate also supports the binary type:
   
   ```java
   abstract class Truncate<T> implements Transform<T, T> {
     @SuppressWarnings("unchecked")
     static <T> Truncate<T> get(Type type, int width) {
       Preconditions.checkArgument(width > 0,
           "Invalid truncate width: %s (must be > 0)", width);
   
       switch (type.typeId()) {
         case INTEGER:
           return (Truncate<T>) new TruncateInteger(width);
         case LONG:
           return (Truncate<T>) new TruncateLong(width);
         case DECIMAL:
           return (Truncate<T>) new TruncateDecimal(width);
         case STRING:
           return (Truncate<T>) new TruncateString(width);
         case BINARY:
           return (Truncate<T>) new TruncateByteBuffer(width);
         default:
           throw new UnsupportedOperationException(
               "Cannot truncate type: " + type);
       }
     }
   ```


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