presto-spi/src/main/java/io/prestosql/spi/block/BlockUtil.java/BlockUtil/compactSlice
class BlockUtil:    static Slice compactSlice(Slice slice, int index, int length)
    {
        if (slice.isCompact() && index == 0 && length == slice.length()) {
            return slice;
        }
        return Slices.copyOf(slice, index, length);
    }