@Override public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) { if(PrelUtil.getSettings(getCluster()).useDefaultCosting()) { return super.computeSelfCost(planner).multiplyBy(.1); } if (joincategory == JoinCategory.CARTESIAN || joincategory == JoinCategory.INEQUALITY) { return planner.getCostFactory().makeInfiniteCost(); } return computeHashJoinCost(planner, mq); }
@Override public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) { if(PrelUtil.getSettings(getCluster()).useDefaultCosting()) { return super.computeSelfCost(planner).multiplyBy(.1); } if (joincategory == JoinCategory.CARTESIAN || joincategory == JoinCategory.INEQUALITY) { return ((Factory)planner.getCostFactory()).makeInfiniteCost(); } double leftRowCount = mq.getRowCount(this.getLeft()); double rightRowCount = mq.getRowCount(this.getRight()); // cost of evaluating each leftkey=rightkey join condition double joinConditionCost = DremioCost.COMPARE_CPU_COST * this.getLeftKeys().size(); double cpuCost = joinConditionCost * (leftRowCount + rightRowCount); Factory costFactory = (Factory)planner.getCostFactory(); return costFactory.makeCost(leftRowCount + rightRowCount, cpuCost, 0, 0); }
@Override public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) { if(PrelUtil.getSettings(getCluster()).useDefaultCosting()) { return super.computeSelfCost(planner).multiplyBy(.1); } double leftRowCount = mq.getRowCount(this.getLeft()); double rightRowCount = mq.getRowCount(this.getRight()); double nljFactor = PrelUtil.getSettings(getCluster()).getNestedLoopJoinFactor(); // cpu cost of evaluating each leftkey=rightkey join condition double joinConditionCost = DremioCost.COMPARE_CPU_COST * this.getLeftKeys().size(); double cpuCost = joinConditionCost * (leftRowCount * rightRowCount) * nljFactor; Factory costFactory = (Factory) planner.getCostFactory(); return costFactory.makeCost(leftRowCount * rightRowCount, cpuCost, 0, 0, 0); }