use of org.apache.drill.exec.planner.cost.DrillCostBase in project drill by axbaretto.
the class DrillJoinRelBase method computeCartesianJoinCost.
protected RelOptCost computeCartesianJoinCost(RelOptPlanner planner, RelMetadataQuery mq) {
final double probeRowCount = mq.getRowCount(this.getLeft());
final double buildRowCount = mq.getRowCount(this.getRight());
final DrillCostFactory costFactory = (DrillCostFactory) planner.getCostFactory();
// This is a magic number,
final double mulFactor = 10000;
// just to make sure Cartesian Join is more expensive
// than Non-Cartesian Join.
// assume having 1 join key, when estimate join cost.
final int keySize = 1;
final DrillCostBase cost = (DrillCostBase) computeHashJoinCostWithKeySize(planner, keySize, mq).multiplyBy(mulFactor);
// Cartesian join row count will be product of two inputs. The other factors come from the above estimated DrillCost.
return costFactory.makeCost(buildRowCount * probeRowCount, cost.getCpu(), cost.getIo(), cost.getNetwork(), cost.getMemory());
}
use of org.apache.drill.exec.planner.cost.DrillCostBase in project drill by axbaretto.
the class MemoryEstimationVisitor method findCost.
private double findCost(Prel prel, RelMetadataQuery mq) {
DrillCostBase cost = (DrillCostBase) mq.getNonCumulativeCost(prel);
double memory = cost.getMemory();
for (Prel child : prel) {
memory += findCost(child, mq);
}
return memory;
}
Aggregations