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

rong pushed a commit to branch iotdb-1022-v2
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/iotdb-1022-v2 by this push:
     new 6862068  fix aggregation tests
6862068 is described below

commit 6862068dd6e5187ec92a98178f888e68bdea226b
Author: SteveYurongSu <[email protected]>
AuthorDate: Fri May 14 19:43:16 2021 +0800

    fix aggregation tests
---
 .../iotdb/db/qp/strategy/optimizer/ConcatPathOptimizer.java    | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git 
a/server/src/main/java/org/apache/iotdb/db/qp/strategy/optimizer/ConcatPathOptimizer.java
 
b/server/src/main/java/org/apache/iotdb/db/qp/strategy/optimizer/ConcatPathOptimizer.java
index b36dab9..42784e1 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/qp/strategy/optimizer/ConcatPathOptimizer.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/qp/strategy/optimizer/ConcatPathOptimizer.java
@@ -84,7 +84,7 @@ public class ConcatPathOptimizer implements ILogicalOptimizer 
{
   }
 
   private void concatSelect(QueryOperator queryOperator) {
-    if (queryOperator.isAlignByDevice()) {
+    if (queryOperator.isAlignByDevice() && !queryOperator.isLastQuery()) {
       return;
     }
 
@@ -120,14 +120,14 @@ public class ConcatPathOptimizer implements 
ILogicalOptimizer {
       return;
     }
 
-    if (queryOperator.isAlignByDevice()) {
+    Set<PartialPath> filterPaths = new HashSet<>();
+    if (!queryOperator.isAlignByDevice() || queryOperator.isLastQuery()) {
       // GROUP_BY_DEVICE leaves the concatFilter to PhysicalGenerator to 
optimize filter without
       // prefix first
-      queryOperator.getFilterOperator().setPathSet(new HashSet<>());
-    } else {
       queryOperator.setFilterOperator(
-          concatFilter(queryOperator.getFromOperator().getPrefixPaths(), 
filter, new HashSet<>()));
+          concatFilter(queryOperator.getFromOperator().getPrefixPaths(), 
filter, filterPaths));
     }
+    queryOperator.getFilterOperator().setPathSet(filterPaths);
   }
 
   private FilterOperator concatFilter(

Reply via email to