// implement RelNode public RelOptCost computeSelfCost(RelOptPlanner planner) { double dRows = RelMetadataQuery.getRowCount(this); // Assume CPU is negligible since values are precomputed. double dCpu = 1; double dIo = 0; return planner.makeCost(dRows, dCpu, dIo); }
@Override public RelOptCost computeSelfCost(RelOptPlanner planner) { // Higher cost if rows are wider discourages pushing a project through a // sort. double rowCount = RelMetadataQuery.getRowCount(this); double bytesPerRow = getRowType().getFieldCount() * 4; return planner.getCostFactory().makeCost(Util.nLogN(rowCount) * bytesPerRow, rowCount, 0); }
@Override public RelOptCost computeSelfCost(RelOptPlanner planner) { if (PrelUtil.getSettings(getCluster()).useDefaultCosting()) { return super.computeSelfCost(planner).multiplyBy(.1); } RelNode child = this.getChild(); double inputRows = RelMetadataQuery.getRowCount(child); int rowWidth = child.getRowType().getFieldCount() * DrillCostBase.AVG_FIELD_WIDTH; double hashCpuCost = DrillCostBase.HASH_CPU_COST * inputRows * distFields.size(); double svrCpuCost = DrillCostBase.SVR_CPU_COST * inputRows; double mergeCpuCost = DrillCostBase.COMPARE_CPU_COST * inputRows * (Math.log(numEndPoints) / Math.log(2)); double networkCost = DrillCostBase.BYTE_NETWORK_COST * inputRows * rowWidth; DrillCostFactory costFactory = (DrillCostFactory) planner.getCostFactory(); return costFactory.makeCost(inputRows, hashCpuCost + svrCpuCost + mergeCpuCost, 0, networkCost); }
public RelOptCost computeSelfCost(RelOptPlanner planner) { double dRows = RelMetadataQuery.getRowCount(this); double dCpu = RelMetadataQuery.getRowCount(getChild()) * program.getExprCount(); double dIo = 0; return planner.makeCost(dRows, dCpu, dIo); }