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 05:06:40 UTC

[GitHub] [incubator-iotdb] LebronAl opened a new pull request #1433: Abstract InsertPlan

LebronAl opened a new pull request #1433:
URL: https://github.com/apache/incubator-iotdb/pull/1433


   Hi, this PR is working on an abstraction of InsertPlan and InsertTabletPlan, which will rename InsertPlan to InsertRowPlan and make an abstraction from the two plans


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



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

Posted by GitBox <gi...@apache.org>.
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



[GitHub] [incubator-iotdb] qiaojialin merged pull request #1433: Abstract InsertPlan

Posted by GitBox <gi...@apache.org>.
qiaojialin merged pull request #1433:
URL: https://github.com/apache/incubator-iotdb/pull/1433


   


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



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

Posted by GitBox <gi...@apache.org>.
SilverNarcissus commented on a change in pull request #1433:
URL: https://github.com/apache/incubator-iotdb/pull/1433#discussion_r446803845



##########
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:
       maybe you should use "markFailedMeasurementInsertion"




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



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

Posted by GitBox <gi...@apache.org>.
LebronAl commented on pull request #1433:
URL: https://github.com/apache/incubator-iotdb/pull/1433#issuecomment-650908514


   @jt2594838 @qiaojialin PTAL


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