You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by hu...@apache.org on 2022/05/27 00:52:42 UTC
[iotdb] branch master updated: Fix Last Query Bug for Aligned (#6038)
This is an automated email from the ASF dual-hosted git repository.
hui pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new 327e07bf22 Fix Last Query Bug for Aligned (#6038)
327e07bf22 is described below
commit 327e07bf22b410df2d3febe96593813943a11b1c
Author: Jackie Tien <ja...@gmail.com>
AuthorDate: Fri May 27 08:52:38 2022 +0800
Fix Last Query Bug for Aligned (#6038)
---
.../iotdb/db/mpp/execution/operator/LastQueryUtil.java | 14 ++++++++++++--
.../iotdb/db/mpp/plan/planner/LocalExecutionPlanner.java | 5 +++--
2 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/LastQueryUtil.java b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/LastQueryUtil.java
index 19e9571171..0ec8d36dd6 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/LastQueryUtil.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/LastQueryUtil.java
@@ -22,6 +22,7 @@ import org.apache.iotdb.db.mpp.aggregation.Aggregator;
import org.apache.iotdb.db.mpp.aggregation.LastValueDescAccumulator;
import org.apache.iotdb.db.mpp.aggregation.MaxTimeDescAccumulator;
import org.apache.iotdb.db.mpp.plan.planner.plan.parameter.AggregationStep;
+import org.apache.iotdb.db.mpp.plan.planner.plan.parameter.InputLocation;
import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
import org.apache.iotdb.tsfile.read.TimeValuePair;
import org.apache.iotdb.tsfile.read.common.block.TsBlockBuilder;
@@ -33,6 +34,7 @@ import org.apache.iotdb.tsfile.utils.Binary;
import com.google.common.collect.ImmutableList;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
public class LastQueryUtil {
@@ -67,8 +69,16 @@ public class LastQueryUtil {
public static List<Aggregator> createAggregators(TSDataType dataType) {
// max_time, last_value
List<Aggregator> aggregators = new ArrayList<>(2);
- aggregators.add(new Aggregator(new MaxTimeDescAccumulator(), AggregationStep.SINGLE));
- aggregators.add(new Aggregator(new LastValueDescAccumulator(dataType), AggregationStep.SINGLE));
+ aggregators.add(
+ new Aggregator(
+ new MaxTimeDescAccumulator(),
+ AggregationStep.SINGLE,
+ Collections.singletonList(new InputLocation[] {new InputLocation(0, 0)})));
+ aggregators.add(
+ new Aggregator(
+ new LastValueDescAccumulator(dataType),
+ AggregationStep.SINGLE,
+ Collections.singletonList(new InputLocation[] {new InputLocation(0, 0)})));
return aggregators;
}
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/LocalExecutionPlanner.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/LocalExecutionPlanner.java
index 26d9306095..9e37b44da9 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/LocalExecutionPlanner.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/LocalExecutionPlanner.java
@@ -1148,7 +1148,7 @@ public class LocalExecutionPlanner {
UpdateLastCacheOperator.class.getSimpleName()),
lastQueryScan,
node.getSeriesPath(),
- node.getSeriesPath().getSeriesType(),
+ node.getSeriesPath().getSchemaList().get(0).getType(),
DATA_NODE_SCHEMA_CACHE,
context.needUpdateLastCache);
}
@@ -1163,7 +1163,8 @@ public class LocalExecutionPlanner {
AlignedSeriesAggregationScanOperator.class.getSimpleName());
// last_time, last_value
- List<Aggregator> aggregators = LastQueryUtil.createAggregators(seriesPath.getSeriesType());
+ List<Aggregator> aggregators =
+ LastQueryUtil.createAggregators(seriesPath.getSchemaList().get(0).getType());
AlignedSeriesAggregationScanOperator seriesAggregationScanOperator =
new AlignedSeriesAggregationScanOperator(
node.getPlanNodeId(),