jt2594838 commented on code in PR #16199:
URL: https://github.com/apache/iotdb/pull/16199#discussion_r2297747337
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/AlignedTVList.java:
##########
@@ -1451,33 +1500,49 @@ public BitMap getAllValueColDeletedMap() {
}
byte[] rowBitsArr = new byte[rowCount / Byte.SIZE + 1];
- for (int row = 0; row < rowCount; row += Byte.SIZE) {
- boolean isFirstColumn = true;
- byte rowBits = 0x00;
- for (int columnIndex = 0; columnIndex < values.size(); columnIndex++) {
- List<BitMap> columnBitMaps = bitMaps.get(columnIndex);
- byte columnBits;
- if (values.get(columnIndex) == null) {
- columnBits = (byte) 0xFF;
- } else if (columnBitMaps == null || columnBitMaps.get(row /
ARRAY_SIZE) == null) {
- // row exists when any column value exists
- rowBits = 0x00;
- break;
- } else {
- columnBits =
- columnBitMaps.get(row / ARRAY_SIZE).getByteArray()[(row %
ARRAY_SIZE) / Byte.SIZE];
+ int bitsMapSize = rowCount / ARRAY_SIZE + 1;
+ boolean[] allNullArray = new boolean[bitsMapSize];
+ Arrays.fill(rowBitsArr, (byte) 0xFF);
+ for (int columnIndex = 0; columnIndex < values.size(); columnIndex++) {
+ List<BitMap> columnBitMaps = bitMaps.get(columnIndex);
+ if (columnBitMaps == null) {
+ Arrays.fill(rowBitsArr, (byte) 0x00);
+ break;
+ } else if (values.get(columnIndex) != null) {
+ int row = 0;
+ boolean isEnd = true;
+ for (int i = 0; i < bitsMapSize; i++) {
+ if (allNullArray[i]) {
+ row += ARRAY_SIZE;
+ continue;
+ }
+
+ BitMap bitMap = columnBitMaps.get(i);
+ int index = row / Byte.SIZE;
+ int size = ((Math.min((rowCount - row), ARRAY_SIZE)) + 7) >>> 3;
+ row += ARRAY_SIZE;
+
+ if (bitMap == null) {
+ Arrays.fill(rowBitsArr, index, index + size, (byte) 0x00);
+ allNullArray[i] = true;
+ continue;
+ }
+
+ byte bits = (byte) 0XFF;
+ for (int j = 0; j < size; j++) {
+ rowBitsArr[index] &= bitMap.getByteArray()[j];
+ bits &= rowBitsArr[index++];
+ isEnd = false;
+ }
Review Comment:
Check this paragraph
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/AlignedTVList.java:
##########
@@ -1451,33 +1500,49 @@ public BitMap getAllValueColDeletedMap() {
}
byte[] rowBitsArr = new byte[rowCount / Byte.SIZE + 1];
- for (int row = 0; row < rowCount; row += Byte.SIZE) {
- boolean isFirstColumn = true;
- byte rowBits = 0x00;
- for (int columnIndex = 0; columnIndex < values.size(); columnIndex++) {
- List<BitMap> columnBitMaps = bitMaps.get(columnIndex);
- byte columnBits;
- if (values.get(columnIndex) == null) {
- columnBits = (byte) 0xFF;
- } else if (columnBitMaps == null || columnBitMaps.get(row /
ARRAY_SIZE) == null) {
- // row exists when any column value exists
- rowBits = 0x00;
- break;
- } else {
- columnBits =
- columnBitMaps.get(row / ARRAY_SIZE).getByteArray()[(row %
ARRAY_SIZE) / Byte.SIZE];
+ int bitsMapSize = rowCount / ARRAY_SIZE + 1;
+ boolean[] allNullArray = new boolean[bitsMapSize];
Review Comment:
allNullArray -> allNotNullArray
--
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]