Skip to content

Commit

Permalink
left zigzag
Browse files Browse the repository at this point in the history
  • Loading branch information
englefly committed Nov 2, 2023
1 parent 00eba56 commit c5c5606
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,12 @@ public Rule build() {

public static boolean checkReorder(LogicalJoin<? extends Plan, GroupPlan> topJoin,
LogicalJoin<GroupPlan, GroupPlan> bottomJoin) {
double bRows = bottomJoin.right().getGroup().getStatistics().getRowCount();
double cRows = topJoin.right().getGroup().getStatistics().getRowCount();
return bRows < cRows && !bottomJoin.getJoinReorderContext().hasCommuteZigZag()
// double bRows = bottomJoin.right().getGroup().getStatistics().getRowCount();
// double cRows = topJoin.right().getGroup().getStatistics().getRowCount();
// return bRows < cRows && !bottomJoin.getJoinReorderContext().hasCommuteZigZag()
// && !topJoin.getJoinReorderContext().hasLAsscom()
// && (!bottomJoin.isMarkJoin() && !topJoin.isMarkJoin());
return !bottomJoin.getJoinReorderContext().hasCommuteZigZag()
&& !topJoin.getJoinReorderContext().hasLAsscom()
&& (!bottomJoin.isMarkJoin() && !topJoin.isMarkJoin());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ private static Statistics estimateNestLoopJoin(Statistics leftStats, Statistics

private static Statistics estimateInnerJoin(Statistics leftStats, Statistics rightStats, Join join) {
if (hashJoinConditionContainsUnknownColumnStats(leftStats, rightStats, join)) {
double rowCount = leftStats.getRowCount() + rightStats.getRowCount();
double rowCount = Math.max(leftStats.getRowCount(), rightStats.getRowCount());
rowCount = Math.max(1, rowCount);
return new StatisticsBuilder()
.setRowCount(rowCount)
Expand Down

0 comments on commit c5c5606

Please sign in to comment.