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/06/29 16:09:09 UTC

[GitHub] [incubator-iotdb] LebronAl commented on a change in pull request #1433: Abstract InsertPlan

LebronAl commented on a change in pull request #1433:
URL: https://github.com/apache/incubator-iotdb/pull/1433#discussion_r447086561



##########
File path: server/src/main/java/org/apache/iotdb/db/qp/physical/crud/InsertPlan.java
##########
@@ -369,97 +81,16 @@ public int getFailedMeasurementNumber() {
     return failedMeasurements == null ? 0 : failedMeasurements.size();
   }
 
-  public TSDataType[] getTypes() {
-    return types;
-  }
-
-  public void setTypes(TSDataType[] types) {
-    this.types = types;
-  }
-
-  public void setValues(ByteBuffer buffer) throws QueryProcessException {
-    for (int i = 0; i < measurements.length; i++) {
-      types[i] = ReadWriteIOUtils.readDataType(buffer);
-      switch (types[i]) {
-        case BOOLEAN:
-          values[i] = ReadWriteIOUtils.readBool(buffer);
-          break;
-        case INT32:
-          values[i] = ReadWriteIOUtils.readInt(buffer);
-          break;
-        case INT64:
-          values[i] = ReadWriteIOUtils.readLong(buffer);
-          break;
-        case FLOAT:
-          values[i] = ReadWriteIOUtils.readFloat(buffer);
-          break;
-        case DOUBLE:
-          values[i] = ReadWriteIOUtils.readDouble(buffer);
-          break;
-        case TEXT:
-          values[i] = ReadWriteIOUtils.readBinary(buffer);
-          break;
-        default:
-          throw new QueryProcessException("Unsupported data type:" + types[i]);
-      }
-    }
-  }
-
-  @Override
-  public void serialize(ByteBuffer buffer) {
-    int type = PhysicalPlanType.INSERT.ordinal();
-    buffer.put((byte) type);
-    buffer.putLong(time);
-
-    putString(buffer, deviceId);
-
-    buffer.putInt(measurements.length - (failedMeasurements == null ? 0 : failedMeasurements.size()));
-
-    for (String measurement : measurements) {
-      if (measurement != null) {
-        putString(buffer, measurement);
-      }
-    }
-
-    try {
-      putValues(buffer);
-    } catch (QueryProcessException e) {
-      e.printStackTrace();
-    }
-  }
-
-  @Override
-  public void deserialize(ByteBuffer buffer) {
-    this.time = buffer.getLong();
-    this.deviceId = readString(buffer);
-
-    int measurementSize = buffer.getInt();
-
-    this.measurements = new String[measurementSize];
-    for (int i = 0; i < measurementSize; i++) {
-      measurements[i] = readString(buffer);
-    }
-
-    this.types = new TSDataType[measurementSize];
-    this.values = new Object[measurementSize];
-    try {
-      setValues(buffer);
-    } catch (QueryProcessException e) {
-      e.printStackTrace();
+  /**
+   * @param index failed measurement index
+   */
+  public void markMeasurementInsertionFailed(int index) {

Review comment:
       OK~




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