use of org.apache.ignite.internal.sql.engine.metadata.cost.IgniteCostFactory in project ignite-3 by apache.
the class IgniteReduceHashAggregate method computeSelfCost.
/**
* {@inheritDoc}
*/
@Override
public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) {
IgniteCostFactory costFactory = (IgniteCostFactory) planner.getCostFactory();
double rows = mq.getRowCount(getInput());
double mem = 0d;
if (aggCalls.isEmpty()) {
mem = groupSet.cardinality() * IgniteCost.AVERAGE_FIELD_SIZE;
} else {
for (AggregateCall aggCall : aggCalls) {
if (aggCall.isDistinct()) {
mem += IgniteCost.AGG_CALL_MEM_COST * rows;
} else {
mem += IgniteCost.AGG_CALL_MEM_COST;
}
}
}
return costFactory.makeCost(rows, rows * IgniteCost.ROW_PASS_THROUGH_COST, 0, mem, 0);
}
use of org.apache.ignite.internal.sql.engine.metadata.cost.IgniteCostFactory in project ignite-3 by apache.
the class IgniteReduceSortAggregate method computeSelfCost.
/**
* {@inheritDoc}
*/
@Override
public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) {
IgniteCostFactory costFactory = (IgniteCostFactory) planner.getCostFactory();
double rows = mq.getRowCount(getInput());
return costFactory.makeCost(rows, rows * IgniteCost.ROW_PASS_THROUGH_COST, 0);
}
use of org.apache.ignite.internal.sql.engine.metadata.cost.IgniteCostFactory in project ignite-3 by apache.
the class IgniteSetOp method computeSetOpCost.
/**
* Compute cost for set op.
*/
public default RelOptCost computeSetOpCost(RelOptPlanner planner, RelMetadataQuery mq) {
IgniteCostFactory costFactory = (IgniteCostFactory) planner.getCostFactory();
double inputRows = 0;
for (RelNode input : getInputs()) {
inputRows += mq.getRowCount(input);
}
double mem = 0.5 * inputRows * aggregateFieldsCount() * IgniteCost.AVERAGE_FIELD_SIZE;
return costFactory.makeCost(inputRows, inputRows * IgniteCost.ROW_PASS_THROUGH_COST, 0, mem, 0);
}
use of org.apache.ignite.internal.sql.engine.metadata.cost.IgniteCostFactory in project ignite-3 by apache.
the class IgniteMinusBase method computeSelfCost.
/**
* {@inheritDoc}
*/
@Override
public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) {
IgniteCostFactory costFactory = (IgniteCostFactory) planner.getCostFactory();
double rows = estimateRowCount(mq);
double inputRows = 0;
for (RelNode input : getInputs()) {
inputRows += mq.getRowCount(input);
}
double mem = 0.5 * inputRows * aggregateFieldsCount() * IgniteCost.AVERAGE_FIELD_SIZE;
return costFactory.makeCost(rows, inputRows * IgniteCost.ROW_PASS_THROUGH_COST, 0, mem, 0);
}
use of org.apache.ignite.internal.sql.engine.metadata.cost.IgniteCostFactory in project ignite-3 by apache.
the class IgniteAggregate method computeSelfCostHash.
/**
* ComputeSelfCostHash.
* TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public RelOptCost computeSelfCostHash(RelOptPlanner planner, RelMetadataQuery mq) {
IgniteCostFactory costFactory = (IgniteCostFactory) planner.getCostFactory();
double inRows = mq.getRowCount(getInput());
double groups = estimateRowCount(mq);
return costFactory.makeCost(inRows, inRows * IgniteCost.ROW_PASS_THROUGH_COST, 0, groups * estimateMemoryForGroup(mq), 0);
}
Aggregations