You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by qi...@apache.org on 2020/11/07 05:56:40 UTC
[iotdb] branch rel/0.11 updated: optimize max_time with value
filter (#1979)
This is an automated email from the ASF dual-hosted git repository.
qiaojialin pushed a commit to branch rel/0.11
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/rel/0.11 by this push:
new 8ff002a optimize max_time with value filter (#1979)
8ff002a is described below
commit 8ff002a5f81a2930d4cc911c5b486ec1db28d466
Author: Xiangwei Wei <34...@users.noreply.github.com>
AuthorDate: Sat Nov 7 13:52:15 2020 +0800
optimize max_time with value filter (#1979)
(cherry picked from commit 8df4d57ffd3d1fdf2b55724a64a5553e48d092c2)
---
.../java/org/apache/iotdb/db/conf/IoTDBConstant.java | 1 +
.../iotdb/db/query/executor/AggregationExecutor.java | 16 ++++++++++++++--
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConstant.java b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConstant.java
index 2ea59a2..2b62db9 100644
--- a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConstant.java
+++ b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConstant.java
@@ -54,6 +54,7 @@ public class IoTDBConstant {
public static final String PROFILE_SUFFIX = ".profile";
public static final String MAX_TIME = "max_time";
public static final String MIN_TIME = "min_time";
+ public static final String LAST_VALUE = "last_value";
public static final int MIN_SUPPORTED_JDK_VERSION = 8;
// show info
diff --git a/server/src/main/java/org/apache/iotdb/db/query/executor/AggregationExecutor.java b/server/src/main/java/org/apache/iotdb/db/query/executor/AggregationExecutor.java
index 17e953e..568eb7d 100644
--- a/server/src/main/java/org/apache/iotdb/db/query/executor/AggregationExecutor.java
+++ b/server/src/main/java/org/apache/iotdb/db/query/executor/AggregationExecutor.java
@@ -26,6 +26,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import org.apache.iotdb.db.conf.IoTDBConstant;
import org.apache.iotdb.db.conf.IoTDBDescriptor;
import org.apache.iotdb.db.engine.querycontext.QueryDataSource;
import org.apache.iotdb.db.exception.StorageEngineException;
@@ -62,7 +63,7 @@ public class AggregationExecutor {
protected List<TSDataType> dataTypes;
protected List<String> aggregations;
protected IExpression expression;
- protected final boolean ascending;
+ protected boolean ascending;
/**
* aggregation batch calculation size.
@@ -283,7 +284,18 @@ public class AggregationExecutor {
*/
public QueryDataSet executeWithValueFilter(QueryContext context, RawDataQueryPlan queryPlan)
throws StorageEngineException, IOException, QueryProcessException {
-
+ int index = 0;
+ for (; index < aggregations.size(); index++) {
+ String aggregationFunc = aggregations.get(index);
+ if (!aggregationFunc.equals(IoTDBConstant.MAX_TIME) && !aggregationFunc
+ .equals(IoTDBConstant.LAST_VALUE)) {
+ break;
+ }
+ }
+ if (index >= aggregations.size()) {
+ queryPlan.setAscending(false);
+ this.ascending = false;
+ }
TimeGenerator timestampGenerator = getTimeGenerator(context, queryPlan);
List<IReaderByTimestamp> readersOfSelectedSeries = new ArrayList<>();
for (int i = 0; i < selectedSeries.size(); i++) {