presto-thrift-api/src/main/java/io/prestosql/plugin/thrift/api/datatypes/PrestoThriftTypeUtils.java/PrestoThriftTypeUtils/calculateOffsets
class PrestoThriftTypeUtils:    public static int[] calculateOffsets(int[] sizes, boolean[] nulls, int totalRecords)
    {
        if (sizes == null) {
            return new int[totalRecords + 1];
        }
        int[] offsets = new int[totalRecords + 1];
        offsets[0] = 0;
        for (int i = 0; i < totalRecords; i++) {
            int size = nulls != null && nulls[i] ? 0 : sizes[i];
            offsets[i + 1] = offsets[i] + size;
        }
        return offsets;
    }