Skip to content

Commit

Permalink
If child is DistributionSpecGather, topN should forbid two-phase topN
Browse files Browse the repository at this point in the history
  • Loading branch information
xiedeyantu committed Jun 26, 2024
1 parent 3a8dbe4 commit 19bf6b9
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,19 @@ public Boolean visitAbstractPhysicalSort(AbstractPhysicalSort<? extends Plan> so
return true;
}

@Override
public Boolean visitPhysicalTopN(PhysicalTopN<? extends Plan> topN, Void context) {
// process must shuffle
visit(topN, context);

// If child is DistributionSpecGather, topN should forbid two-phase topN
if (topN.getSortPhase() == SortPhase.LOCAL_SORT
&& childrenProperties.get(0).getDistributionSpec().equals(DistributionSpecGather.INSTANCE)) {
return false;
}
return true;
}

/**
* check both side real output hash key order are same or not.
*
Expand Down

0 comments on commit 19bf6b9

Please sign in to comment.