HTHou commented on a change in pull request #2858:
URL: https://github.com/apache/iotdb/pull/2858#discussion_r595695692



##########
File path: tsfile/src/main/java/org/apache/iotdb/tsfile/write/record/Tablet.java
##########
@@ -58,6 +59,8 @@
   public long[] timestamps;
   /** each object is a primitive type array, which represents values of one 
measurement */
   public Object[] values;
+  /** each bitset represents the existence of each value in the current column 
*/
+  public BitSet[] BitSets;

Review comment:
       ```suggestion
     /** each bitset represents the existence of each value in the current 
column */
     public bitSet[] BitSets;
   ```

##########
File path: session/src/main/java/org/apache/iotdb/session/SessionUtils.java
##########
@@ -58,42 +59,95 @@ public static ByteBuffer getValueBuffer(Tablet tablet) {
 
   private static void getValueBufferOfDataType(
       TSDataType dataType, Tablet tablet, int i, ByteBuffer valueBuffer) {
+    int lastPos = 0, nextPos;
+    BitSet curBitset = tablet.BitSets[i];
+
     switch (dataType) {
       case INT32:
         int[] intValues = (int[]) tablet.values[i];
-        for (int index = 0; index < tablet.rowSize; index++) {
-          valueBuffer.putInt(intValues[index]);
+        while (true) {
+          nextPos = curBitset.nextClearBit(lastPos);
+          for (int index = lastPos; index < nextPos; index++) {
+            valueBuffer.putInt(intValues[index]);
+          }
+          if (nextPos == tablet.rowSize) {
+            break;
+          }
+          valueBuffer.putInt(-1);
+          lastPos = nextPos + 1;

Review comment:
       Is there any way to put the bitSet into valueBuffer? The server needs to 
get the bitSet to know which value is valid....




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to