You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by yu...@apache.org on 2020/07/14 09:00:33 UTC

[incubator-iotdb] branch kyy2 updated: avoid adding null to failed list

This is an automated email from the ASF dual-hosted git repository.

yuyuankang pushed a commit to branch kyy2
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git


The following commit(s) were added to refs/heads/kyy2 by this push:
     new fb006d3  avoid adding null to failed list
fb006d3 is described below

commit fb006d36443fb1a4183bd06ffcdaafd961a14195
Author: Ring-k <yu...@hotmail.com>
AuthorDate: Tue Jul 14 17:00:05 2020 +0800

    avoid adding null to failed list
---
 .../java/org/apache/iotdb/db/qp/physical/crud/InsertPlan.java    | 3 +++
 .../java/org/apache/iotdb/db/qp/physical/crud/InsertRowPlan.java | 9 +++++++--
 .../org/apache/iotdb/db/qp/physical/crud/InsertTabletPlan.java   | 3 +++
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/InsertPlan.java b/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/InsertPlan.java
index c7b9954..6b3d17c 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/InsertPlan.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/InsertPlan.java
@@ -97,6 +97,9 @@ public abstract class InsertPlan extends PhysicalPlan {
    * @param index failed measurement index
    */
   public void markFailedMeasurementInsertion(int index, Exception e) {
+    if(measurements[index] == null){
+      return;
+    }
     if (failedMeasurements == null) {
       failedMeasurements = new ArrayList<>();
       failedExceptions = new ArrayList<>();
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/InsertRowPlan.java b/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/InsertRowPlan.java
index 82acd24..a93338a 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/InsertRowPlan.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/InsertRowPlan.java
@@ -191,6 +191,9 @@ public class InsertRowPlan extends InsertPlan {
 
   @Override
   public void markFailedMeasurementInsertion(int index, Exception e) {
+    if (measurements[index] == null) {
+      return;
+    }
     super.markFailedMeasurementInsertion(index, e);
     if (failedValues == null) {
       failedValues = new ArrayList<>();
@@ -391,7 +394,8 @@ public class InsertRowPlan extends InsertPlan {
     putString(buffer, deviceId);
 
     buffer
-        .putInt(measurements.length - (failedMeasurements == null ? 0 : failedMeasurements.size()));
+        .putInt(
+            measurements.length - (failedMeasurements == null ? 0 : failedMeasurements.size()));
 
     for (String measurement : measurements) {
       if (measurement != null) {
@@ -456,7 +460,8 @@ public class InsertRowPlan extends InsertPlan {
     System.arraycopy(this.values, 0, valuesClone, 0, valuesClone.length);
     TSDataType[] typesClone = new TSDataType[this.dataTypes.length];
     System.arraycopy(this.dataTypes, 0, typesClone, 0, typesClone.length);
-    return new InsertRowPlan(deviceIdClone, timeClone, measurementsClone, typesClone, valuesClone);
+    return new InsertRowPlan(deviceIdClone, timeClone, measurementsClone, typesClone,
+        valuesClone);
   }
 
   @Override
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/InsertTabletPlan.java b/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/InsertTabletPlan.java
index da4347b..c258967 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/InsertTabletPlan.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/InsertTabletPlan.java
@@ -502,6 +502,9 @@ public class InsertTabletPlan extends InsertPlan {
   }
 
   public void markFailedMeasurementInsertion(int index, Exception e) {
+    if (measurements[index] == null) {
+      return;
+    }
     super.markFailedMeasurementInsertion(index, e);
     if (failedColumns == null) {
       failedColumns = new ArrayList<>();