You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ro...@apache.org on 2021/05/18 03:24:22 UTC
[iotdb] branch iotdb-1022-v2 updated (c8164b8 -> 661311f)
This is an automated email from the ASF dual-hosted git repository.
rong pushed a change to branch iotdb-1022-v2
in repository https://gitbox.apache.org/repos/asf/iotdb.git.
discard c8164b8 fix aggregation * query tests
new 661311f fix aggregation * query tests
This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version. This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:
* -- * -- B -- O -- O -- O (c8164b8)
\
N -- N -- N refs/heads/iotdb-1022-v2 (661311f)
You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.
Any revisions marked "omit" are not gone; other references still
refer to them. Any revisions marked "discard" are gone forever.
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../java/org/apache/iotdb/db/integration/IoTDBQueryMemoryControlIT.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[iotdb] 01/01: fix aggregation * query tests
Posted by ro...@apache.org.
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
commit 661311f2846b10cf6556a56e38cec047798d2418
Author: SteveYurongSu <st...@outlook.com>
AuthorDate: Tue May 18 11:19:14 2021 +0800
fix aggregation * query tests
---
.../iotdb/db/qp/logical/crud/SelectOperator.java | 14 ++++++++++----
.../iotdb/db/qp/strategy/PhysicalGenerator.java | 9 +++++----
.../apache/iotdb/db/qp/utils/WildcardsRemover.java | 21 ++++++++++++++++++---
3 files changed, 33 insertions(+), 11 deletions(-)
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/SelectOperator.java b/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/SelectOperator.java
index 14d2c24..7030161 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/SelectOperator.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/SelectOperator.java
@@ -96,10 +96,16 @@ public final class SelectOperator extends Operator {
pathsCache = new ArrayList<>();
for (ResultColumn resultColumn : resultColumns) {
Expression expression = resultColumn.getExpression();
- pathsCache.add(
- expression instanceof TimeSeriesOperand
- ? ((TimeSeriesOperand) expression).getPath()
- : null);
+ if (expression instanceof TimeSeriesOperand) {
+ pathsCache.add(((TimeSeriesOperand) expression).getPath());
+ } else if (expression instanceof FunctionExpression
+ && expression.isAggregationFunctionExpression()) {
+ pathsCache.add(
+ ((TimeSeriesOperand) ((FunctionExpression) expression).getExpressions().get(0))
+ .getPath());
+ } else {
+ pathsCache.add(null);
+ }
}
}
return pathsCache;
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/strategy/PhysicalGenerator.java b/server/src/main/java/org/apache/iotdb/db/qp/strategy/PhysicalGenerator.java
index 9ea5d3a..6b3e691 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/strategy/PhysicalGenerator.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/strategy/PhysicalGenerator.java
@@ -462,7 +462,7 @@ public class PhysicalGenerator {
@Override
public QueryPlan transform(QueryOperator queryOperator) throws QueryProcessException {
- QueryPlan queryPlan;
+ AggregationPlan queryPlan;
if (queryOperator.hasTimeSeriesGeneratingFunction()) {
throw new QueryProcessException(
"User-defined and built-in hybrid aggregation is not supported.");
@@ -474,8 +474,9 @@ public class PhysicalGenerator {
} else {
queryPlan = new AggregationPlan();
}
- ((AggregationPlan) queryPlan)
- .setAggregations(queryOperator.getSelectOperator().getAggregationFunctions());
+
+ queryPlan.setPaths(queryOperator.getSelectOperator().getPaths());
+ queryPlan.setAggregations(queryOperator.getSelectOperator().getAggregationFunctions());
if (queryOperator.isGroupByTime()) {
GroupByTimePlan groupByTimePlan = (GroupByTimePlan) queryPlan;
@@ -500,7 +501,7 @@ public class PhysicalGenerator {
}
}
} else if (queryOperator.isGroupByLevel()) {
- ((AggregationPlan) queryPlan).setLevel(queryOperator.getLevel());
+ queryPlan.setLevel(queryOperator.getLevel());
try {
if (!verifyAllAggregationDataTypesEqual(queryOperator)) {
throw new QueryProcessException("Aggregate among unmatched data types");
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/utils/WildcardsRemover.java b/server/src/main/java/org/apache/iotdb/db/qp/utils/WildcardsRemover.java
index 41696af..580b3e4 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/utils/WildcardsRemover.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/utils/WildcardsRemover.java
@@ -65,6 +65,15 @@ public class WildcardsRemover {
consumed = 0;
}
+ public WildcardsRemover(ConcatPathOptimizer concatPathOptimizer) {
+ this.concatPathOptimizer = concatPathOptimizer;
+
+ maxDeduplicatedPathNum = Integer.MAX_VALUE - 1;
+ soffset = 0;
+ limit = maxDeduplicatedPathNum + 1;
+ consumed = 0;
+ }
+
public List<PartialPath> removeWildcardFrom(PartialPath path) throws LogicalOptimizeException {
try {
Pair<List<PartialPath>, Integer> pair =
@@ -108,7 +117,8 @@ public class WildcardsRemover {
boolean atLeastOneSeriesNotExisted = false;
for (Expression originExpression : expressions) {
List<Expression> actualExpressions = new ArrayList<>();
- originExpression.removeWildcards(this, actualExpressions);
+ originExpression.removeWildcards(
+ new WildcardsRemover(concatPathOptimizer), actualExpressions);
if (actualExpressions.isEmpty()) {
atLeastOneSeriesNotExisted = true;
break;
@@ -122,16 +132,21 @@ public class WildcardsRemover {
List<List<Expression>> actualExpressions = new ArrayList<>();
ConcatPathOptimizer.cartesianProduct(
extendedExpressions, actualExpressions, 0, new ArrayList<>());
- for (@SuppressWarnings("squid:S1481") List<Expression> ignored : actualExpressions) {
+
+ List<List<Expression>> splitExpressions = new ArrayList<>();
+ for (List<Expression> actualExpression : actualExpressions) {
if (offset != 0) {
--offset;
+ continue;
} else if (limit != 0) {
--limit;
} else {
break;
}
+ splitExpressions.add(actualExpression);
}
- return actualExpressions;
+ consumed += actualExpressions.size();
+ return splitExpressions;
}
/** @return should break the loop or not */