You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2020/02/26 08:17:53 UTC
[GitHub] [incubator-iotdb] Ring-k commented on a change in pull request
#841: [IOTDB-476] Improve the ExpressionOptimizer
Ring-k commented on a change in pull request #841: [IOTDB-476] Improve the ExpressionOptimizer
URL: https://github.com/apache/incubator-iotdb/pull/841#discussion_r384330875
##########
File path: tsfile/src/main/java/org/apache/iotdb/tsfile/read/expression/util/ExpressionOptimizer.java
##########
@@ -108,13 +108,66 @@ private IExpression handleOneGlobalTimeFilter(GlobalTimeExpression globalTimeExp
addTimeFilterToQueryFilter((globalTimeExpression).getFilter(), regularRightIExpression);
return regularRightIExpression;
} else if (relation == ExpressionType.OR) {
- return BinaryExpression
- .or(pushGlobalTimeFilterToAllSeries(globalTimeExpression, selectedSeries),
- regularRightIExpression);
+ IExpression afterTransform = pushGlobalTimeFilterToAllSeries(globalTimeExpression,
+ selectedSeries);
+ return mergeSecondTreeToFirstTree(afterTransform, regularRightIExpression);
}
throw new QueryFilterOptimizationException("unknown relation in IExpression:" + relation);
}
+ /**
+ * This method merge the second input, which is of tree structure, to the first parameter. It
+ * visits all leaf nodes, which are SingleSeriesExpressions, or AndExpression in right Expression,
+ * merge them to the right position in leftExpression.
+ *
+ * @param leftExpression The IExpression transformed from GlobalTimeExpression, which might have
+ * already be updated and merged.
+ * @param rightExpression The IExpression to be merged into the first IExpression
+ * @return a merged IExpression, which is initially based on the input leftExpression
+ */
+ private IExpression mergeSecondTreeToFirstTree(IExpression leftExpression,
+ IExpression rightExpression) {
+ if (rightExpression.getType() == ExpressionType.SERIES) {
+ SingleSeriesExpression leaf = (SingleSeriesExpression) rightExpression;
+ updateFilterWithOr(leftExpression, leaf.getFilter(), leaf.getSeriesPath());
+ return leftExpression;
+ } else if (rightExpression.getType() == ExpressionType.SERIES) {
Review comment:
It's a mistake. Thanks for your reminding.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services