presto-parquet/src/main/java/io/prestosql/parquet/reader/ListColumnReader.java/ListColumnReader/calculateCollectionOffsets
class ListColumnReader:    public static void calculateCollectionOffsets(Field field, IntList offsets, BooleanList collectionIsNull, int[] definitionLevels, int[] repetitionLevels)
    {
        int maxDefinitionLevel = field.getDefinitionLevel();
        int maxElementRepetitionLevel = field.getRepetitionLevel() + 1;
        boolean required = field.isRequired();
        int offset = 0;
        offsets.add(offset);
        for (int i = 0; i < definitionLevels.length; i = getNextCollectionStartIndex(repetitionLevels, maxElementRepetitionLevel, i)) {
            if (ParquetTypeUtils.isValueNull(required, definitionLevels[i], maxDefinitionLevel)) {
                // Collection is null
                collectionIsNull.add(true);
                offsets.add(offset);
            }
            else if (definitionLevels[i] == maxDefinitionLevel) {
                // Collection is defined but empty
                collectionIsNull.add(false);
                offsets.add(offset);
            }
            else if (definitionLevels[i] > maxDefinitionLevel) {
                // Collection is defined and not empty
                collectionIsNull.add(false);
                offset += getCollectionSize(repetitionLevels, maxElementRepetitionLevel, i + 1);
                offsets.add(offset);
            }
        }
    }