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 2023/01/01 09:34:33 UTC
[GitHub] [iotdb] lancelly commented on a diff in pull request #8683: Fix bug in last query
lancelly commented on code in PR #8683:
URL: https://github.com/apache/iotdb/pull/8683#discussion_r1059728166
##########
server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/distribution/SourceRewriter.java:
##########
@@ -525,13 +528,46 @@ public List<PlanNode> visitLastQuery(LastQueryNode node, DistributionPlanContext
PlanNode root = processRawMultiChildNode(node, context);
if (context.queryMultiRegion) {
PlanNode newRoot = genLastQueryRootNode(node, context);
+ // add sort op for each if we add LastQueryMergeNode as root
+ if (newRoot instanceof LastQueryMergeNode && node.getMergeOrderParameter().isEmpty()) {
+ OrderByParameter orderByParameter =
+ new OrderByParameter(
+ Collections.singletonList(new SortItem(SortKey.TIMESERIES, Ordering.ASC)));
+ addSortForEachLastQueryNode(root, orderByParameter);
+ }
root.getChildren().forEach(newRoot::addChild);
return Collections.singletonList(newRoot);
} else {
return Collections.singletonList(root);
}
}
+ private void addSortForEachLastQueryNode(PlanNode root, OrderByParameter orderByParameter) {
+ if (root instanceof LastQueryNode) {
Review Comment:
It's possible that the children of LastQueryNode are still LastQueryNodes and these children won't be handled by this method.
<img width="798" alt="截屏2023-01-01 17 30 24" src="https://user-images.githubusercontent.com/108499334/210166400-3c6728ea-c73d-4893-8a63-526ae68c7c54.png">
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org