761417898 commented on code in PR #345:
URL: https://github.com/apache/tsfile/pull/345#discussion_r1900310949


##########
cpp/src/common/tablet.cc:
##########
@@ -104,6 +105,47 @@ int Tablet::add_value(uint32_t row_index, uint32_t 
schema_index, T val) {
     return ret;
 }
 
+void* Tablet::get_value(int row_index, uint32_t schema_index, 
common::TSDataType& data_type) const {
+    if (LIKELY(schema_index >= schema_vec_->size())) {
+        return nullptr;
+    }
+    const MeasurementSchema& schema = schema_vec_->at(schema_index);
+
+    void* column_values = value_matrix_[schema_index];
+    data_type = schema.data_type_;
+    if (!bitmaps_[schema_index].test(row_index)) {
+        return nullptr;
+    }

Review Comment:
   In the Java edition implementation
   ```java
   private void setBit(boolean isNull) {
     if (!isNull) {
       bitmap |= (MASK >>> (size % 8));
     }
     size++;
     if (size % 8 == 0) {
       bitmapOut.write(bitmap);
       bitmap = 0;
     }
   }
   
   /**
    * Write time series into encoder.
    */
   public void write(
       long[] timestamps, boolean[] values, boolean[] isNull, int batchSize, 
int arrayOffset) {
     for (int i = arrayOffset; i < batchSize + arrayOffset; i++) {
       setBit(isNull[i]);
       if (!isNull[i]) {
         valueEncoder.encode(values[i], valueOut);
         statistics.update(timestamps[i], values[i]);
       }
     }
   }



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

Reply via email to