public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) { // REVIEW jvs 8-Jan-2006: what is supposed to be here // for an abstract rel? return planner.getCostFactory().makeHugeCost(); } }
public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) { // REVIEW jvs 8-Jan-2006: what is supposed to be here // for an abstract rel? return planner.getCostFactory().makeHugeCost(); } }
@Override public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) { for (AggregateCall aggCall : getAggCallList()) { String name = aggCall.getAggregation().getName(); // For avg, stddev_pop, stddev_samp, var_pop and var_samp, the ReduceAggregatesRule is supposed // to convert them to use sum and count. Here, we make the cost of the original functions high // enough such that the planner does not choose them and instead chooses the rewritten functions. // Except when AVG, STDDEV_POP, STDDEV_SAMP, VAR_POP and VAR_SAMP are used with DECIMAL type. if ((name.equals(SqlKind.AVG.name()) || name.equals(SqlKind.STDDEV_POP.name()) || name.equals(SqlKind.STDDEV_SAMP.name()) || name.equals(SqlKind.VAR_POP.name()) || name.equals(SqlKind.VAR_SAMP.name())) && aggCall.getType().getSqlTypeName() != SqlTypeName.DECIMAL) { return planner.getCostFactory().makeHugeCost(); } } return computeLogicalAggCost(planner, mq); }
setInitialImportance(); RelOptCost targetCost = costFactory.makeHugeCost(); int tick = 0; int firstFiniteTick = -1;
setInitialImportance(); RelOptCost targetCost = costFactory.makeHugeCost(); int tick = 0; int firstFiniteTick = -1;
@Override public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery relMetadataQuery) { for (AggregateCall aggCall : getAggCallList()) { // For avg, stddev_pop, stddev_samp, var_pop and var_samp, the ReduceAggregatesRule is supposed // to convert them to use sum and count. Here, we make the cost of the original functions high // enough such that the planner does not choose them and instead chooses the rewritten functions. if (aggCall.getAggregation().getKind() == SqlKind.AVG || aggCall.getAggregation().getKind() == SqlKind.STDDEV_SAMP || aggCall.getAggregation().getKind() == SqlKind.STDDEV_POP || aggCall.getAggregation().getKind() == SqlKind.VAR_POP || aggCall.getAggregation().getKind() == SqlKind.VAR_SAMP) { return planner.getCostFactory().makeHugeCost(); } } final double rowCount = relMetadataQuery.getRowCount(this); final double childRowCount = relMetadataQuery.getRowCount(this.getInput()); // Aggregates with more aggregate functions cost a bit more float multiplier = 1f + (float) aggCalls.size() * 0.125f; return ((Factory) planner.getCostFactory()).makeCost(rowCount,childRowCount * multiplier * DremioCost.FUNC_CPU_COST, 0, 0); }