Esempio n. 1
0
  // 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);
  }
Esempio n. 2
0
 @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);
 }
  private double findCost(Prel prel) {
    DrillCostBase cost = (DrillCostBase) RelMetadataQuery.getNonCumulativeCost(prel);
    double memory = cost.getMemory();

    for (Prel child : prel) {
      memory += findCost(child);
    }
    return memory;
  }
  @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);
  }
Esempio n. 5
0
 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);
 }
 @Override
 public Double visitPrel(Prel prel, Void value) throws RuntimeException {
   return ((DrillCostBase) RelMetadataQuery.getCumulativeCost(prel)).getMemory();
   //    return findCost(prel);
 }