Skip to content

Commit

Permalink
h18 adjust join left right ignorable diff
Browse files Browse the repository at this point in the history
  • Loading branch information
englefly committed Dec 2, 2023
1 parent f42e538 commit bb4e6ba
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class CostModelV1 extends PlanVisitor<Cost, PlanContext> {
static final double BROADCAST_JOIN_SKEW_RATIO = 30.0;
static final double BROADCAST_JOIN_SKEW_PENALTY_LIMIT = 2.0;
static final double RANDOM_SHUFFLE_TO_HASH_SHUFFLE_FACTOR = 0.1;
static final double JOIN_LEFT_RIGHT_DIFF_IGNORE_THRESHOLD = 10.0;
private final int beNumber;

public CostModelV1(ConnectContext connectContext) {
Expand Down Expand Up @@ -265,11 +266,11 @@ public Cost visitPhysicalHashJoin(

double leftRowCount = probeStats.getRowCount();
double rightRowCount = buildStats.getRowCount();
if (Math.abs(leftRowCount - rightRowCount) < 10) {
if (Math.abs(leftRowCount - rightRowCount) < JOIN_LEFT_RIGHT_DIFF_IGNORE_THRESHOLD) {
int leftConnectivity = computeConnectivity(physicalHashJoin.left(), context);
int rightConnectivity = computeConnectivity(physicalHashJoin.right(), context);
if (rightConnectivity < leftConnectivity) {
leftRowCount += 10;
leftRowCount += JOIN_LEFT_RIGHT_DIFF_IGNORE_THRESHOLD;
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
*/
public class JoinEstimation {
private static double DEFAULT_ANTI_JOIN_SELECTIVITY_COEFFICIENT = 0.3;
private static double UNKNOWN_COL_STATS_FILTER_SEL_LOWER_BOUND = 0.5;
private static double UNKNOWN_COL_STATS_FILTER_SEL_LOWER_BOUND = 0.1;

private static EqualPredicate normalizeHashJoinCondition(EqualPredicate equal, Statistics leftStats,
Statistics rightStats) {
Expand Down

0 comments on commit bb4e6ba

Please sign in to comment.