Skip to content

Commit

Permalink
[BugFix] Consider CN number in HashJoinCostModel.
Browse files Browse the repository at this point in the history
Signed-off-by: Song Jiacheng <[email protected]>
  • Loading branch information
Jcnessss committed Oct 18, 2024
1 parent 24dfaaf commit cdfe339
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ public double getCpuCost() {
double probeCost;
double leftOutput = leftStatistics.getOutputSize(context.getChildOutputColumns(0));
double rightOutput = rightStatistics.getOutputSize(context.getChildOutputColumns(1));
int parallelFactor = Math.max(ConnectContext.get().getAliveBackendNumber(),
int parallelFactor = Math.max(ConnectContext.get().getAliveBackendNumber() +
ConnectContext.get().getGlobalStateMgr().getNodeMgr().getClusterInfo().getAliveComputeNodeNumber(),
ConnectContext.get().getSessionVariable().getDegreeOfParallelism());
switch (execMode) {
case BROADCAST:
Expand All @@ -112,7 +113,8 @@ public double getMemCost() {
JoinExecMode execMode = deriveJoinExecMode();
double rightOutput = rightStatistics.getOutputSize(context.getChildOutputColumns(1));
double memCost;
int beNum = Math.max(1, ConnectContext.get().getAliveBackendNumber());
int beNum = Math.max(1, ConnectContext.get().getAliveBackendNumber() +
ConnectContext.get().getGlobalStateMgr().getNodeMgr().getClusterInfo().getAliveComputeNodeNumber());

if (JoinExecMode.BROADCAST == execMode) {
memCost = rightOutput * beNum;
Expand All @@ -127,7 +129,8 @@ private double getAvgProbeCost() {
double keySize = calculateKeySize();

double cachePenaltyFactor;
int parallelFactor = Math.max(ConnectContext.get().getAliveBackendNumber(),
int parallelFactor = Math.max(ConnectContext.get().getAliveBackendNumber() +
ConnectContext.get().getGlobalStateMgr().getNodeMgr().getClusterInfo().getAliveComputeNodeNumber(),
ConnectContext.get().getSessionVariable().getDegreeOfParallelism()) * 2;
double mapSize = Math.min(1, keySize) * rightStatistics.getOutputRowCount();

Expand Down

0 comments on commit cdfe339

Please sign in to comment.