From 5807dec0d231b769533d390dc7eab635649cb9b2 Mon Sep 17 00:00:00 2001 From: Zhong Wang Date: Mon, 13 Sep 2021 22:45:25 +0800 Subject: [PATCH 1/2] [IOTDB-1629] fix the NPE when using value fill in cluster mode (#3913) --- .../query/fill/ClusterFillExecutor.java | 4 +- .../{ => fill}/ClusterFillExecutorTest.java | 47 ++++++++++++++++++- 2 files changed, 48 insertions(+), 3 deletions(-) rename cluster/src/test/java/org/apache/iotdb/cluster/query/{ => fill}/ClusterFillExecutorTest.java (74%) diff --git a/cluster/src/main/java/org/apache/iotdb/cluster/query/fill/ClusterFillExecutor.java b/cluster/src/main/java/org/apache/iotdb/cluster/query/fill/ClusterFillExecutor.java index 1dc1363a6c341..08cf2f29f8acf 100644 --- a/cluster/src/main/java/org/apache/iotdb/cluster/query/fill/ClusterFillExecutor.java +++ b/cluster/src/main/java/org/apache/iotdb/cluster/query/fill/ClusterFillExecutor.java @@ -67,8 +67,10 @@ protected IFill configureFill( IFill clusterFill = new ClusterPreviousFill((PreviousFill) fill, metaGroupMember); clusterFill.configureFill(path, dataType, queryTime, deviceMeasurements, context); return clusterFill; + } else { + fill.configureFill(path, dataType, queryTime, deviceMeasurements, context); + return fill; } - return null; } @Override diff --git a/cluster/src/test/java/org/apache/iotdb/cluster/query/ClusterFillExecutorTest.java b/cluster/src/test/java/org/apache/iotdb/cluster/query/fill/ClusterFillExecutorTest.java similarity index 74% rename from cluster/src/test/java/org/apache/iotdb/cluster/query/ClusterFillExecutorTest.java rename to cluster/src/test/java/org/apache/iotdb/cluster/query/fill/ClusterFillExecutorTest.java index 5c8c1769db107..35543f58a91eb 100644 --- a/cluster/src/test/java/org/apache/iotdb/cluster/query/ClusterFillExecutorTest.java +++ b/cluster/src/test/java/org/apache/iotdb/cluster/query/fill/ClusterFillExecutorTest.java @@ -17,10 +17,11 @@ * under the License. */ -package org.apache.iotdb.cluster.query; +package org.apache.iotdb.cluster.query.fill; import org.apache.iotdb.cluster.common.TestUtils; -import org.apache.iotdb.cluster.query.fill.ClusterFillExecutor; +import org.apache.iotdb.cluster.query.BaseQueryTest; +import org.apache.iotdb.cluster.query.RemoteQueryContext; import org.apache.iotdb.db.conf.IoTDBDescriptor; import org.apache.iotdb.db.exception.StorageEngineException; import org.apache.iotdb.db.exception.metadata.IllegalPathException; @@ -32,6 +33,7 @@ import org.apache.iotdb.db.query.executor.fill.IFill; import org.apache.iotdb.db.query.executor.fill.LinearFill; import org.apache.iotdb.db.query.executor.fill.PreviousFill; +import org.apache.iotdb.db.query.executor.fill.ValueFill; import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType; import org.apache.iotdb.tsfile.read.query.dataset.QueryDataSet; @@ -127,4 +129,45 @@ public void testLinearFill() QueryResourceManager.getInstance().endQuery(context.getQueryId()); } } + + @Test + public void testValueFill() + throws QueryProcessException, StorageEngineException, IOException, IllegalPathException { + FillQueryPlan plan = new FillQueryPlan(); + plan.setDeduplicatedPaths( + Collections.singletonList(new PartialPath(TestUtils.getTestSeries(0, 10)))); + plan.setDeduplicatedDataTypes(Collections.singletonList(TSDataType.DOUBLE)); + plan.setPaths(plan.getDeduplicatedPaths()); + plan.setDataTypes(plan.getDeduplicatedDataTypes()); + double fillValue = 1.0D; + Map tsDataTypeIFillMap = + Collections.singletonMap( + TSDataType.DOUBLE, new ValueFill(Double.toString(fillValue), TSDataType.DOUBLE)); + plan.setFillType(tsDataTypeIFillMap); + QueryContext context = + new RemoteQueryContext(QueryResourceManager.getInstance().assignQueryId(true)); + + try { + ClusterFillExecutor fillExecutor; + QueryDataSet queryDataSet; + long[] queryTimes = new long[] {-1, 0, 5, 10, 20}; + Object[][] answers = + new Object[][] { + new Object[] {1.0D}, + new Object[] {0.0D}, + new Object[] {1.0D}, + new Object[] {10.0D}, + new Object[] {1.0D}, + }; + for (int i = 0; i < queryTimes.length; i++) { + plan.setQueryTime(queryTimes[i]); + fillExecutor = new ClusterFillExecutor(plan, testMetaMember); + queryDataSet = fillExecutor.execute(context); + checkDoubleDataset(queryDataSet, answers[i]); + assertFalse(queryDataSet.hasNext()); + } + } finally { + QueryResourceManager.getInstance().endQuery(context.getQueryId()); + } + } } From 36760bf9ef224b38587006fec0a3c211b9120424 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Oct 2021 10:12:13 +0000 Subject: [PATCH 2/2] Bump gson from 2.8.6 to 2.8.8 Bumps [gson](https://github.com/google/gson) from 2.8.6 to 2.8.8. - [Release notes](https://github.com/google/gson/releases) - [Changelog](https://github.com/google/gson/blob/master/CHANGELOG.md) - [Commits](https://github.com/google/gson/compare/gson-parent-2.8.6...gson-parent-2.8.8) --- updated-dependencies: - dependency-name: com.google.code.gson:gson dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 81cc46ddaea58..f1c6cc5cfd45e 100644 --- a/pom.xml +++ b/pom.xml @@ -150,7 +150,7 @@ target/jacoco-merged-reports/jacoco.xml target/surefire-reports,target/failsafe-reports - 2.8.6 + 2.8.8 false