This is an automated email from the ASF dual-hosted git repository.

jackietien pushed a commit to branch LastOperator
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/LastOperator by this push:
     new 1b02cca705 Fix Last Query Bug for Aligned
1b02cca705 is described below

commit 1b02cca70578f78a8e2c0c1753bfa8503b364524
Author: JackieTien97 <[email protected]>
AuthorDate: Thu May 26 22:13:07 2022 +0800

    Fix Last Query Bug for Aligned
---
 .../iotdb/db/mpp/execution/operator/LastQueryUtil.java     | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 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;
   }
 

Reply via email to