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

hui pushed a commit to branch lmh/refactorFilter
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/lmh/refactorFilter by this 
push:
     new 94cd175fb97 remove lastQueryTimeFilter
94cd175fb97 is described below

commit 94cd175fb9725b62ad58d4c1e83fa6d560534a46
Author: Minghui Liu <[email protected]>
AuthorDate: Sun Nov 19 22:55:52 2023 +0800

    remove lastQueryTimeFilter
---
 .../plan/planner/LocalExecutionPlanContext.java            | 11 +----------
 .../db/queryengine/plan/planner/OperatorTreeGenerator.java | 14 +++++---------
 2 files changed, 6 insertions(+), 19 deletions(-)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/LocalExecutionPlanContext.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/LocalExecutionPlanContext.java
index cc3b11e14aa..4eab8230235 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/LocalExecutionPlanContext.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/LocalExecutionPlanContext.java
@@ -76,8 +76,7 @@ public class LocalExecutionPlanContext {
   // left is cached last value in last query
   // right is full path for each cached last value
   private List<Pair<TimeValuePair, Binary>> cachedLastValueAndPathList;
-  // timeFilter for last query
-  private Filter lastQueryTimeFilter;
+
   // whether we need to update last cache
   private boolean needUpdateLastCache;
   private boolean needUpdateNullEntry;
@@ -226,10 +225,6 @@ public class LocalExecutionPlanContext {
     return allSensors;
   }
 
-  public void setLastQueryTimeFilter(Filter lastQueryTimeFilter) {
-    this.lastQueryTimeFilter = lastQueryTimeFilter;
-  }
-
   public void setNeedUpdateLastCache(boolean needUpdateLastCache) {
     this.needUpdateLastCache = needUpdateLastCache;
   }
@@ -272,10 +267,6 @@ public class LocalExecutionPlanContext {
     return driverContext.getFragmentInstanceContext();
   }
 
-  public Filter getLastQueryTimeFilter() {
-    return lastQueryTimeFilter;
-  }
-
   public boolean isNeedUpdateLastCache() {
     return needUpdateLastCache;
   }
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/OperatorTreeGenerator.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/OperatorTreeGenerator.java
index cb6392dc207..5ad861231a0 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/OperatorTreeGenerator.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/OperatorTreeGenerator.java
@@ -2136,10 +2136,10 @@ public class OperatorTreeGenerator extends 
PlanVisitor<Operator, LocalExecutionP
     } else if (timeValuePair.getValue() == null) { // there is no data for 
this time series
       return null;
     } else if (!LastQueryUtil.satisfyFilter(
-        updateFilterUsingTTL(context.getLastQueryTimeFilter(), 
context.getDataRegionTTL()),
+        updateFilterUsingTTL(context.getGlobalTimeFilter(), 
context.getDataRegionTTL()),
         timeValuePair)) { // cached last value is not satisfied
 
-      if (!isFilterGtOrGe(context.getLastQueryTimeFilter())) {
+      if (!isFilterGtOrGe(context.getGlobalTimeFilter())) {
         // time filter is not > or >=, we still need to read from disk
         return createUpdateLastCacheOperator(node, context, 
node.getSeriesPath());
       } else { // otherwise, we just ignore it and return null
@@ -2256,7 +2256,7 @@ public class OperatorTreeGenerator extends 
PlanVisitor<Operator, LocalExecutionP
     SeriesScanOptions.Builder scanOptionsBuilder = new 
SeriesScanOptions.Builder();
     scanOptionsBuilder.withAllSensors(
         context.getAllSensors(seriesPath.getDevice(), 
seriesPath.getMeasurement()));
-    scanOptionsBuilder.withGlobalTimeFilter(context.getLastQueryTimeFilter());
+    scanOptionsBuilder.withGlobalTimeFilter(context.getGlobalTimeFilter());
 
     SeriesAggregationScanOperator seriesAggregationScanOperator =
         new SeriesAggregationScanOperator(
@@ -2287,12 +2287,9 @@ public class OperatorTreeGenerator extends 
PlanVisitor<Operator, LocalExecutionP
     ITimeRangeIterator timeRangeIterator = initTimeRangeIterator(null, false, 
false);
     long maxReturnSize = 
calculateMaxAggregationResultSizeForLastQuery(aggregators);
 
-    Filter timeFilter = context.getLastQueryTimeFilter();
     SeriesScanOptions.Builder scanOptionsBuilder = new 
SeriesScanOptions.Builder();
     scanOptionsBuilder.withAllSensors(new 
HashSet<>(unCachedPath.getMeasurementList()));
-    if (timeFilter != null) {
-      scanOptionsBuilder.withGlobalTimeFilter(timeFilter);
-    }
+    scanOptionsBuilder.withGlobalTimeFilter(context.getGlobalTimeFilter());
 
     OperatorContext operatorContext =
         context
@@ -2348,7 +2345,7 @@ public class OperatorTreeGenerator extends 
PlanVisitor<Operator, LocalExecutionP
       } else if (timeValuePair.getValue() == null) {
         // there is no data for this time series, just ignore
       } else if (!LastQueryUtil.satisfyFilter(
-          updateFilterUsingTTL(context.getLastQueryTimeFilter(), 
context.getDataRegionTTL()),
+          updateFilterUsingTTL(context.getGlobalTimeFilter(), 
context.getDataRegionTTL()),
           timeValuePair)) { // cached last value is not satisfied
 
         if (!isFilterGtOrGe(context.getGlobalTimeFilter())) {
@@ -2377,7 +2374,6 @@ public class OperatorTreeGenerator extends 
PlanVisitor<Operator, LocalExecutionP
   @Override
   public Operator visitLastQuery(LastQueryNode node, LocalExecutionPlanContext 
context) {
     Filter globalTimeFilter = context.getGlobalTimeFilter();
-    context.setLastQueryTimeFilter(globalTimeFilter);
     
context.setNeedUpdateLastCache(LastQueryUtil.needUpdateCache(globalTimeFilter));
     
context.setNeedUpdateNullEntry(LastQueryUtil.needUpdateNullEntry(globalTimeFilter));
 

Reply via email to