presto-spi/src/main/java/io/prestosql/spi/type/Varchars.java/Varchars/truncateToLength
class Varchars:    public static Slice truncateToLength(Slice slice, int maxLength)
    {
        requireNonNull(slice, "slice is null");
        if (maxLength < 0) {
            throw new IllegalArgumentException("Max length must be greater or equal than zero");
        }
        if (maxLength == 0) {
            return Slices.EMPTY_SLICE;
        }

        return slice.slice(0, byteCount(slice, 0, slice.length(), maxLength));
    }