use of org.apache.ignite.internal.sql.engine.metadata.cost.IgniteCostFactory in project ignite-3 by apache.
the class IgniteAggregate method computeSelfCostSort.
/**
* ComputeSelfCostSort.
* TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public RelOptCost computeSelfCostSort(RelOptPlanner planner, RelMetadataQuery mq) {
IgniteCostFactory costFactory = (IgniteCostFactory) planner.getCostFactory();
double inRows = mq.getRowCount(getInput());
return costFactory.makeCost(inRows, inRows * IgniteCost.ROW_PASS_THROUGH_COST, 0, estimateMemoryForGroup(mq), 0);
}
use of org.apache.ignite.internal.sql.engine.metadata.cost.IgniteCostFactory in project ignite-3 by apache.
the class IgniteTableSpool method computeSelfCost.
/**
* {@inheritDoc}
*/
@Override
public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) {
double rowCnt = mq.getRowCount(getInput());
double bytesPerRow = getRowType().getFieldCount() * IgniteCost.AVERAGE_FIELD_SIZE;
double totalBytes = rowCnt * bytesPerRow;
double cpuCost = rowCnt * IgniteCost.ROW_PASS_THROUGH_COST;
IgniteCostFactory costFactory = (IgniteCostFactory) planner.getCostFactory();
return costFactory.makeCost(rowCnt, cpuCost, 0, totalBytes, 0);
}
use of org.apache.ignite.internal.sql.engine.metadata.cost.IgniteCostFactory in project ignite-3 by apache.
the class IgniteExchange method computeSelfCost.
/**
* {@inheritDoc}
*/
@Override
public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) {
double rowCount = mq.getRowCount(getInput());
double bytesPerRow = getRowType().getFieldCount() * IgniteCost.AVERAGE_FIELD_SIZE;
double totalBytes = rowCount * bytesPerRow;
IgniteCostFactory costFactory = (IgniteCostFactory) planner.getCostFactory();
if (RelDistributions.BROADCAST_DISTRIBUTED.equals(distribution)) {
totalBytes *= IgniteCost.BROADCAST_DISTRIBUTION_PENALTY;
}
return costFactory.makeCost(rowCount, rowCount * IgniteCost.ROW_PASS_THROUGH_COST, 0, 0, totalBytes);
}
use of org.apache.ignite.internal.sql.engine.metadata.cost.IgniteCostFactory in project ignite-3 by apache.
the class IgniteMergeJoin method computeSelfCost.
/**
* {@inheritDoc}
*/
@Override
public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) {
IgniteCostFactory costFactory = (IgniteCostFactory) planner.getCostFactory();
double leftCount = mq.getRowCount(getLeft());
if (Double.isInfinite(leftCount)) {
return costFactory.makeInfiniteCost();
}
double rightCount = mq.getRowCount(getRight());
if (Double.isInfinite(rightCount)) {
return costFactory.makeInfiniteCost();
}
double rows = leftCount + rightCount;
return costFactory.makeCost(rows, rows * (IgniteCost.ROW_COMPARISON_COST + 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 IgniteNestedLoopJoin method computeSelfCost.
/**
* {@inheritDoc}
*/
@Override
public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) {
IgniteCostFactory costFactory = (IgniteCostFactory) planner.getCostFactory();
double leftCount = mq.getRowCount(getLeft());
if (Double.isInfinite(leftCount)) {
return costFactory.makeInfiniteCost();
}
double rightCount = mq.getRowCount(getRight());
if (Double.isInfinite(rightCount)) {
return costFactory.makeInfiniteCost();
}
double rows = leftCount * rightCount;
double rightSize = rightCount * getRight().getRowType().getFieldCount() * IgniteCost.AVERAGE_FIELD_SIZE;
return costFactory.makeCost(rows, rows * (IgniteCost.ROW_COMPARISON_COST + IgniteCost.ROW_PASS_THROUGH_COST), 0, rightSize, 0);
}
Aggregations