use of org.apache.drill.exec.planner.cost.DrillCostBase.DrillCostFactory in project drill by apache.
the class DrillProjectRelBase method computeSelfCost.
@Override
public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) {
if (PrelUtil.getSettings(getCluster()).useDefaultCosting()) {
return super.computeSelfCost(planner, mq).multiplyBy(.1);
}
double rowCount = mq.getRowCount(this);
// Attribute small cost for projecting simple fields. In reality projecting simple columns in not free and
// this allows projection pushdown/project-merge rules to kick-in thereby eliminating unneeded columns from
// the projection.
double cpuCost = DrillCostBase.PROJECT_CPU_COST * rowCount * nonSimpleFieldCount + (this.getRowType().getFieldCount() - nonSimpleFieldCount) * rowCount * DrillCostBase.BASE_CPU_COST;
DrillCostFactory costFactory = (DrillCostFactory) planner.getCostFactory();
return costFactory.makeCost(rowCount, cpuCost, 0, 0);
}
Aggregations