lancelly commented on code in PR #14148:
URL: https://github.com/apache/iotdb/pull/14148#discussion_r1862892056
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/distribute/TableDistributedPlanGenerator.java:
##########
@@ -442,18 +418,23 @@ public List<PlanNode> visitFilter(FilterNode node,
PlanContext context) {
@Override
public List<PlanNode> visitJoin(JoinNode node, PlanContext context) {
- // child of JoinNode must be SortNode, so after rewritten, the child must
be MergeSortNode or
- // SortNode
- List<PlanNode> leftChildrenNodes = node.getLeftChild().accept(this,
context);
- checkArgument(
- leftChildrenNodes.size() == 1, "The size of left children node of
JoinNode should be 1");
- node.setLeftChild(leftChildrenNodes.get(0));
+ List<PlanNode> leftChildrenNodes = node.getLeftChild().accept(this,
context);
List<PlanNode> rightChildrenNodes = node.getRightChild().accept(this,
context);
- checkArgument(
- rightChildrenNodes.size() == 1, "The size of right children node of
JoinNode should be 1");
- node.setRightChild(rightChildrenNodes.get(0));
-
+ if (!node.isCrossJoin()) {
+ // child of JoinNode(excluding CrossJoin) must be SortNode, so after
rewritten, the child must
+ // be MergeSortNode or
+ // SortNode
+ checkArgument(
+ leftChildrenNodes.size() == 1, "The size of left children node of
JoinNode should be 1");
+ checkArgument(
+ rightChildrenNodes.size() == 1,
+ "The size of right children node of JoinNode should be 1");
+ }
+ // For CrossJoinNode, we need to merge children nodes(It's safe for other
JoinNodes here since
+ // the size of their children is always 1.)
+ node.setLeftChild(mergeChildrenViaCollectOrMergeSort(null,
leftChildrenNodes));
+ node.setRightChild(mergeChildrenViaCollectOrMergeSort(null,
rightChildrenNodes));
Review Comment:
Nice catch. Fixed.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]