Search in sources :

Example 46 with DrillCostFactory

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);
}
Also used : DrillCostFactory(org.apache.drill.exec.planner.cost.DrillCostBase.DrillCostFactory)

Aggregations

DrillCostFactory (org.apache.drill.exec.planner.cost.DrillCostBase.DrillCostFactory)46 RelNode (org.apache.calcite.rel.RelNode)21 ScanStats (org.apache.drill.exec.physical.base.ScanStats)4 DrillCostBase (org.apache.drill.exec.planner.cost.DrillCostBase)2 DbGroupScan (org.apache.drill.exec.physical.base.DbGroupScan)1