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 1dc1363a6c34..08cf2f29f8ac 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 5c8c1769db10..35543f58a91e 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 f090c5a9279f5438948dcd70991f029c06d047b8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 17 Nov 2021 03:52:34 +0000 Subject: [PATCH 2/2] Bump org.slf4j.version from 1.7.30 to 1.7.32 Bumps `org.slf4j.version` from 1.7.30 to 1.7.32. Updates `jcl-over-slf4j` from 1.7.30 to 1.7.32 - [Release notes](https://github.com/qos-ch/slf4j/releases) - [Commits](https://github.com/qos-ch/slf4j/compare/v_1.7.30...v_1.7.32) Updates `jul-to-slf4j` from 1.7.30 to 1.7.32 - [Release notes](https://github.com/qos-ch/slf4j/releases) - [Commits](https://github.com/qos-ch/slf4j/compare/v_1.7.30...v_1.7.32) Updates `slf4j-api` from 1.7.30 to 1.7.32 - [Release notes](https://github.com/qos-ch/slf4j/releases) - [Commits](https://github.com/qos-ch/slf4j/compare/v_1.7.30...v_1.7.32) Updates `slf4j-log4j12` from 1.7.30 to 1.7.32 - [Release notes](https://github.com/qos-ch/slf4j/releases) - [Commits](https://github.com/qos-ch/slf4j/compare/v_1.7.30...v_1.7.32) Updates `slf4j-jcl` from 1.7.30 to 1.7.32 --- updated-dependencies: - dependency-name: org.slf4j:jcl-over-slf4j dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.slf4j:jul-to-slf4j dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.slf4j:slf4j-api dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.slf4j:slf4j-log4j12 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.slf4j:slf4j-jcl 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 81cc46ddaea5..3051be08c641 100644 --- a/pom.xml +++ b/pom.xml @@ -132,7 +132,7 @@ 3.2.2 3.8.1 1.1.3 - 1.7.30 + 1.7.32 24.1.1 2.14.5 9.4.35.v20201120