@Override public RelNode copy(RelTraitSet traitSet, List<RelNode> inputs) { return new BroadcastExchangePrel(getCluster(), traitSet, sole(inputs)); }
/** * 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); }
public PhysicalOperator getPhysicalOperator(PhysicalPlanCreator creator) throws IOException { Prel child = (Prel) this.getInput(); PhysicalOperator childPOP = child.getPhysicalOperator(creator); //Currently, only accepts "NONE". For other, requires SelectionVectorRemover if (!childPOP.getSVMode().equals(SelectionVectorMode.NONE)) { childPOP = new SelectionVectorRemover(childPOP); } BroadcastExchange g = new BroadcastExchange(childPOP); return creator.addMetadata(this, g); }
toDist.getFields(), toDist.getPartitionFunction()); case BROADCAST_DISTRIBUTED: return new BroadcastExchangePrel(rel.getCluster(), planner.emptyTraitSet().plus(Prel.DRILL_PHYSICAL).plus(toDist), rel); case ANY: