@Override public RelOptCost plus(RelOptCost other) { DrillCostBase that = (DrillCostBase) other; if ((this == INFINITY) || (that == INFINITY)) { return INFINITY; } return new DrillCostBase( this.rowCount + that.rowCount, this.cpu + that.cpu, this.io + that.io, this.network + that.network, this.memory + that.memory); }
@Override public RelOptCost multiplyBy(double factor) { if (this == INFINITY) { return this; } return new DrillCostBase(rowCount * factor, cpu * factor, io * factor, network * factor, memory * factor); }
public RelOptCost makeCost(double dRows, double dCpu, double dIo, double dNetwork) { return new DrillCostBase(dRows, dCpu, dIo, dNetwork, 0); }
@Override public RelOptCost minus(RelOptCost other) { if (this == INFINITY) { return this; } DrillCostBase that = (DrillCostBase) other; return new DrillCostBase( this.rowCount - that.rowCount, this.cpu - that.cpu, this.io - that.io, this.network - that.network, this.memory - that.memory); }
public RelOptCost makeCost(double dRows, double dCpu, double dIo, double dNetwork, double dMemory) { return new DrillCostBase(dRows, dCpu, dIo, dNetwork, dMemory); }
public RelOptCost makeCost(double dRows, double dCpu, double dIo) { return new DrillCostBase(dRows, dCpu, dIo, 0, 0); }
/** * In a BroadcastExchange, each sender is sending data to N receivers (for costing * purposes we assume it is also sending to itself). */ @Override public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) { if(PrelUtil.getSettings(getCluster()).useDefaultCosting()) { return super.computeSelfCost(planner, mq).multiplyBy(.1); } RelNode child = this.getInput(); final int numEndPoints = PrelUtil.getSettings(getCluster()).numEndPoints(); final double broadcastFactor = PrelUtil.getSettings(getCluster()).getBroadcastFactor(); final double inputRows = mq.getRowCount(child); final int rowWidth = child.getRowType().getFieldCount() * DrillCostBase.AVG_FIELD_WIDTH; final double cpuCost = broadcastFactor * DrillCostBase.SVR_CPU_COST * inputRows; // We assume localhost network cost is 1/10 of regular network cost // ( c * num_bytes * (N - 1) ) + ( c * num_bytes * 0.1) // = c * num_bytes * (N - 0.9) // TODO: a similar adjustment should be made to HashExchangePrel final double networkCost = broadcastFactor * DrillCostBase.BYTE_NETWORK_COST * inputRows * rowWidth * (numEndPoints - 0.9); return new DrillCostBase(inputRows, cpuCost, 0, networkCost); }