Skip to content

Commit 43173ce

Browse files
authored
[CBO] Shuffle elimination same Join costs case MapJoin choose (#20600)
1 parent dc91732 commit 43173ce

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ydb/library/yql/dq/opt/dq_opt_dphyp_solver.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,7 @@ template <typename TNodeSet> std::array<std::shared_ptr<IBaseOptimizerNode>, 2>
780780

781781
std::shared_ptr<TJoinOptimizerNodeInternal> tree;
782782
auto shuffleLeftSideBestJoin = PickBestJoin(left, right, edge, true, false, maybeCardHint, maybeAlgoHint);
783-
if (reversedMapJoinStatistics.Cost < shuffleLeftSideBestJoin.Stats.Cost) {
783+
if (reversedMapJoinStatistics.Cost <= shuffleLeftSideBestJoin.Stats.Cost) {
784784
tree = MakeJoinInternal(std::move(reversedMapJoinStatistics), right, left, edge.RightJoinKeys, edge.LeftJoinKeys, edge.JoinKind, EJoinAlgoType::MapJoin, edge.RightAny, edge.LeftAny, right->Stats.LogicalOrderings);
785785
tree->Stats.LogicalOrderings.InduceNewOrderings(edge.FDs | left->Stats.LogicalOrderings.GetFDs());
786786
} else {
@@ -824,7 +824,7 @@ template <typename TNodeSet> std::array<std::shared_ptr<IBaseOptimizerNode>, 2>
824824

825825
std::shared_ptr<TJoinOptimizerNodeInternal> tree;
826826
auto shuffleRightSideBestJoin = PickBestJoin(left, right, edge, false, true, maybeCardHint, maybeAlgoHint);
827-
if (mapJoinStatistics.Cost < shuffleRightSideBestJoin.Stats.Cost) {
827+
if (mapJoinStatistics.Cost <= shuffleRightSideBestJoin.Stats.Cost) {
828828
tree = MakeJoinInternal(std::move(mapJoinStatistics), left, right, edge.LeftJoinKeys, edge.RightJoinKeys, edge.JoinKind, EJoinAlgoType::MapJoin, edge.LeftAny, edge.RightAny, left->Stats.LogicalOrderings);
829829
tree->Stats.LogicalOrderings.InduceNewOrderings(edge.FDs | left->Stats.LogicalOrderings.GetFDs());
830830
} else {

0 commit comments

Comments
 (0)