shizy818 commented on code in PR #14616:
URL: https://github.com/apache/iotdb/pull/14616#discussion_r1909769288
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/AlignedTVList.java:
##########
@@ -1516,4 +1509,212 @@ public List<List<BitMap>> getBitMaps() {
public boolean isAllDeleted() {
return timeDeletedCnt == rowCount;
}
+
+ public AlignedTVListIterator iterator(
+ List<TSDataType> dataTypeList,
+ List<Integer> columnIndexList,
+ boolean ignoreAllNullRows,
+ Integer floatPrecision,
+ List<TSEncoding> encodingList) {
+ return new AlignedTVListIterator(
+ dataTypeList, columnIndexList, ignoreAllNullRows, floatPrecision,
encodingList);
+ }
+
+ /* AlignedTVList Iterator */
+ public class AlignedTVListIterator extends TVListIterator {
+ private BitMap allValueColDeletedMap;
+
+ private TSDataType[] dataTypeArray;
+ private int[] columnIndexArray;
+ private Integer floatPrecision;
+ private TSEncoding[] encodingArray;
+
+ // remember the selected index of last not-null value for each column
during prepareNext phase.
+ // It is already converted by getValueIndex method, so it can be directly
used in
+ // getPrimitiveObject method.
+ private int[] selectedIndex;
+
+ public AlignedTVListIterator() {
+ super();
+ }
+
+ public AlignedTVListIterator(
+ List<TSDataType> dataTypeList,
+ List<Integer> columnIndexList,
+ boolean ignoreAllNullRows,
+ Integer floatPrecision,
+ List<TSEncoding> encodingList) {
+ super(null, null);
+ this.dataTypeArray = dataTypeList.toArray(new TSDataType[0]);
+ this.columnIndexArray =
+ (columnIndexList == null)
+ ? IntStream.range(0, dataTypes.size()).toArray()
+ : columnIndexList.stream().mapToInt(Integer::intValue).toArray();
+ this.allValueColDeletedMap = ignoreAllNullRows ?
getAllValueColDeletedMap() : null;
+ this.floatPrecision = floatPrecision;
+ this.encodingArray = encodingList == null ? null :
encodingList.toArray(new TSEncoding[0]);
+ this.selectedIndex = new int[dataTypeList.size()];
+ }
+
+ private void prepareNext() {
+ // find the first row that is neither deleted nor empty (all NULL values)
+ boolean findValidRow = false;
+ while (index < rows && !findValidRow) {
+ int rowIndex = getValueIndex(index);
+ // all columns values are deleted
+ if ((allValueColDeletedMap != null &&
allValueColDeletedMap.isMarked(rowIndex))
+ || isTimeDeleted(rowIndex, false)) {
+ index++;
+ currentTime = index < rows ? getTime(index) : Long.MIN_VALUE;
+ continue;
+ }
+
+ // does not find any valid row
+ if (index >= rows) {
+ probeNext = true;
+ return;
+ }
+ Arrays.fill(selectedIndex, rowIndex);
+ findValidRow = true;
+ }
+
+ // handle duplicated timestamp
+ while (index + 1 < rows && getTime(index + 1) == currentTime) {
+ index++;
+ // skip all-Null rows if allValueColDeletedMap exits
Review Comment:
oh. you mean type error?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]