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 f749d240a75a9a95a14ed94d451f321214b51167 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 17 Nov 2021 04:07:20 +0000 Subject: [PATCH 2/2] Bump spark.version from 2.4.3 to 2.4.8 Bumps `spark.version` from 2.4.3 to 2.4.8. Updates `spark-core_2.11` from 2.4.3 to 2.4.8 Updates `spark-sql_2.11` from 2.4.3 to 2.4.8 --- updated-dependencies: - dependency-name: org.apache.spark:spark-core_2.11 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.apache.spark:spark-sql_2.11 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..f3427a85955cf 100644 --- a/pom.xml +++ b/pom.xml @@ -118,7 +118,7 @@ 1.7.12 1.2.3 2.9.9 - 2.4.3 + 2.4.8 1.11.1 2.5 4.4