This is an automated email from the ASF dual-hosted git repository. jiangtian pushed a commit to branch jira_1376_0.12 in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit db648403db3d616b44c9e65c7e40a0433b4bad38 Author: jt2594838 <[email protected]> AuthorDate: Thu May 13 19:09:31 2021 +0800 fix empty indices --- .../cluster/log/applier/DataLogApplierTest.java | 29 +++++++++++----------- .../db/qp/physical/crud/InsertMultiTabletPlan.java | 2 +- .../iotdb/db/qp/physical/crud/InsertRowsPlan.java | 2 +- .../qp/physical/sys/CreateMultiTimeSeriesPlan.java | 2 +- 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/cluster/src/test/java/org/apache/iotdb/cluster/log/applier/DataLogApplierTest.java b/cluster/src/test/java/org/apache/iotdb/cluster/log/applier/DataLogApplierTest.java index 0450237..0cf47ee 100644 --- a/cluster/src/test/java/org/apache/iotdb/cluster/log/applier/DataLogApplierTest.java +++ b/cluster/src/test/java/org/apache/iotdb/cluster/log/applier/DataLogApplierTest.java @@ -19,6 +19,19 @@ package org.apache.iotdb.cluster.log.applier; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import junit.framework.TestCase; import org.apache.iotdb.cluster.client.DataClientProvider; import org.apache.iotdb.cluster.client.async.AsyncDataClient; import org.apache.iotdb.cluster.common.IoTDBTest; @@ -68,8 +81,6 @@ import org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding; import org.apache.iotdb.tsfile.read.common.RowRecord; import org.apache.iotdb.tsfile.read.query.dataset.QueryDataSet; import org.apache.iotdb.tsfile.write.schema.TimeseriesSchema; - -import junit.framework.TestCase; import org.apache.thrift.async.AsyncMethodCallback; import org.apache.thrift.protocol.TBinaryProtocol.Factory; import org.junit.After; @@ -78,19 +89,6 @@ import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.ByteArrayOutputStream; -import java.io.DataOutputStream; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - public class DataLogApplierTest extends IoTDBTest { private static final Logger logger = LoggerFactory.getLogger(DataLogApplierTest.class); @@ -356,6 +354,7 @@ public class DataLogApplierTest extends IoTDBTest { public void testApplyCreateMultiTimeseiresWithPulling() throws MetadataException { IoTDB.metaManager.setStorageGroup(new PartialPath("root.sg1")); CreateMultiTimeSeriesPlan multiTimeSeriesPlan = new CreateMultiTimeSeriesPlan(); + multiTimeSeriesPlan.setIndexes(Collections.emptyList()); multiTimeSeriesPlan.setPaths( Arrays.asList( new PartialPath("root.sg1.s1"), diff --git a/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/InsertMultiTabletPlan.java b/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/InsertMultiTabletPlan.java index 1883823..9cc807f 100644 --- a/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/InsertMultiTabletPlan.java +++ b/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/InsertMultiTabletPlan.java @@ -358,7 +358,7 @@ public class InsertMultiTabletPlan extends InsertPlan implements BatchPlan { isExecuted = new boolean[getBatchSize()]; } isExecuted[i] = false; - if (parentInsertTabletPlanIndexList != null) { + if (parentInsertTabletPlanIndexList != null && !parentInsertTabletPlanIndexList.isEmpty()) { results.remove(getParentIndex(i)); } else { results.remove(i); diff --git a/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/InsertRowsPlan.java b/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/InsertRowsPlan.java index 8bcfe32..cc4685a 100644 --- a/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/InsertRowsPlan.java +++ b/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/InsertRowsPlan.java @@ -265,7 +265,7 @@ public class InsertRowsPlan extends InsertPlan implements BatchPlan { isExecuted = new boolean[getBatchSize()]; } isExecuted[i] = false; - if (insertRowPlanIndexList != null) { + if (insertRowPlanIndexList != null && !insertRowPlanIndexList.isEmpty()) { results.remove(insertRowPlanIndexList.get(i)); } else { results.remove(i); diff --git a/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/CreateMultiTimeSeriesPlan.java b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/CreateMultiTimeSeriesPlan.java index d710afb..0fecf01 100644 --- a/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/CreateMultiTimeSeriesPlan.java +++ b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/CreateMultiTimeSeriesPlan.java @@ -374,7 +374,7 @@ public class CreateMultiTimeSeriesPlan extends PhysicalPlan implements BatchPlan isExecuted = new boolean[getBatchSize()]; } isExecuted[i] = false; - if (indexes != null) { + if (indexes != null && !indexes.isEmpty()) { results.remove(indexes.get(i)); } else { results.remove(i);
