@Override
    protected void prepareNext() {
      // find the first row that is neither deleted nor empty (all NULL values)
      findValidRow = false;
      while (index < rows && !findValidRow) {
        // all columns values are deleted
        if ((allValueColDeletedMap != null && allValueColDeletedMap.isMarked(getValueIndex(index)))
            || isTimeDeleted(getValueIndex(index), false)
            || isPointDeleted(getTime(index), timeColumnDeletion, timeDeleteCursor)) {
          index++;
          continue;
        }

        // does not find any valid row
        if (index >= rows) {
          probeNext = true;
          return;
        }
        Arrays.fill(selectedIndices, index);
        findValidRow = true;

        // handle duplicated timestamp
        while (index + 1 < rows && getTime(index + 1) == getTime(index)) {
          index++;
          // skip all-Null rows if allValueColDeletedMap exists
          if (allValueColDeletedMap == null
              || !allValueColDeletedMap.isMarked(getValueIndex(index))) {
            for (int columnIndex = 0; columnIndex < dataTypeList.size(); columnIndex++) {
              // update selected index if the column is not null
              if (!isNullValue(index, columnIndex)) {
                selectedIndices[columnIndex] = index;
              }
            }
          }
        }

        // valueColumnsDeletionList is set when AlignedTVList iterator is created by
        // MemPointIterator.single method. Otherwise, all-null rows is checked by
        // MergeSortMultiAlignedTVListIterator or OrderedMultiAlignedTVListIterator.
        if (valueColumnsDeletionList != null) {
          BitMap bitMap = new BitMap(dataTypeList.size());
          long time = getTime(index);
          for (int columnIndex = 0; columnIndex < dataTypeList.size(); columnIndex++) {
            if (isNullValue(index, columnIndex)
                || isPointDeleted(
                    time,
                    valueColumnsDeletionList.get(columnIndex),
                    valueColumnDeleteCursor.get(columnIndex))) {
              bitMap.mark(columnIndex);
            }
          }
          if (ignoreAllNullRows && bitMap.isAllMarked()) {
            findValidRow = false;
            index++;
          }
        }
      }
      probeNext = true;
    }
@param rowIndex should be the sorted index.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/AlignedTVList.java