You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2020/08/28 10:08:03 UTC

[GitHub] [incubator-iotdb] mychaow commented on a change in pull request #1658: IOTDB-839:Make Tablet api more friendly

mychaow commented on a change in pull request #1658:
URL: https://github.com/apache/incubator-iotdb/pull/1658#discussion_r479064903



##########
File path: tsfile/src/main/java/org/apache/iotdb/tsfile/write/record/Tablet.java
##########
@@ -81,6 +82,43 @@ public Tablet(String deviceId, List<MeasurementSchema> timeseries) {
     this(deviceId, timeseries, DEFAULT_SIZE);
   }
 
+  public void addTimestamp(int rowIndex, long timestamp) {
+    timestamps[rowIndex - 1] = timestamp;
+  }
+
+  public void addValue(MeasurementSchema measurementSchema, int rowIndex, Object value) {
+
+    int indexOfValue = schemas.indexOf(measurementSchema);
+    if (measurementSchema.getType() == INT64) {
+      long[] sensor = (long[]) values[indexOfValue];
+      sensor[rowIndex - 1] = (long) value;
+      values[indexOfValue] = sensor;

Review comment:
       what is the meaning of this line?

##########
File path: tsfile/src/main/java/org/apache/iotdb/tsfile/write/record/Tablet.java
##########
@@ -81,6 +82,43 @@ public Tablet(String deviceId, List<MeasurementSchema> timeseries) {
     this(deviceId, timeseries, DEFAULT_SIZE);
   }
 
+  public void addTimestamp(int rowIndex, long timestamp) {
+    timestamps[rowIndex - 1] = timestamp;
+  }
+
+  public void addValue(MeasurementSchema measurementSchema, int rowIndex, Object value) {
+
+    int indexOfValue = schemas.indexOf(measurementSchema);

Review comment:
       It's not a good way to get the index, measurements maybe very large. You should store the measurementSchema as a map

##########
File path: tsfile/src/main/java/org/apache/iotdb/tsfile/write/record/Tablet.java
##########
@@ -81,6 +82,43 @@ public Tablet(String deviceId, List<MeasurementSchema> timeseries) {
     this(deviceId, timeseries, DEFAULT_SIZE);
   }
 
+  public void addTimestamp(int rowIndex, long timestamp) {

Review comment:
       rowIndex maybe starts with 0?




----------------------------------------------------------------
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:
users@infra.apache.org