public boolean isEqWithEpsilon(RelOptCost other) { return (this == other) || ((Math.abs(this.io - other.getIo()) < RelOptUtil.EPSILON) && (Math.abs(this.cpu - other.getCpu()) < RelOptUtil.EPSILON) && (Math .abs(this.rowCount - other.getRows()) < RelOptUtil.EPSILON)); }
public boolean isEqWithEpsilon(RelOptCost other) { return (this == other) || ((Math.abs(this.io - other.getIo()) < RelOptUtil.EPSILON) && (Math.abs(this.cpu - other.getCpu()) < RelOptUtil.EPSILON) && (Math .abs(this.rowCount - other.getRows()) < RelOptUtil.EPSILON)); }
public boolean equals(RelOptCost other) { return (this == other) || ((this.cpu + this.io == other.getCpu() + other.getIo()) && (this.rowCount == other.getRows())); }
public double divideBy(RelOptCost cost) { // Compute the geometric average of the ratios of all of the factors // which are non-zero and finite. double d = 1; double n = 0; if ((this.rowCount != 0) && !Double.isInfinite(this.rowCount) && (cost.getRows() != 0) && !Double.isInfinite(cost.getRows())) { d *= this.rowCount / cost.getRows(); ++n; } if ((this.cpu != 0) && !Double.isInfinite(this.cpu) && (cost.getCpu() != 0) && !Double.isInfinite(cost.getCpu())) { d *= this.cpu / cost.getCpu(); ++n; } if ((this.io != 0) && !Double.isInfinite(this.io) && (cost.getIo() != 0) && !Double.isInfinite(cost.getIo())) { d *= this.io / cost.getIo(); ++n; } if (n == 0) { return 1.0; } return Math.pow(d, 1 / n); }
public boolean equals(RelOptCost other) { return (this == other) || ((this.cpu + this.io == other.getCpu() + other.getIo()) && (this.rowCount == other.getRows())); }
public double divideBy(RelOptCost cost) { // Compute the geometric average of the ratios of all of the factors // which are non-zero and finite. double d = 1; double n = 0; if ((this.rowCount != 0) && !Double.isInfinite(this.rowCount) && (cost.getRows() != 0) && !Double.isInfinite(cost.getRows())) { d *= this.rowCount / cost.getRows(); ++n; } if ((this.cpu != 0) && !Double.isInfinite(this.cpu) && (cost.getCpu() != 0) && !Double.isInfinite(cost.getCpu())) { d *= this.cpu / cost.getCpu(); ++n; } if ((this.io != 0) && !Double.isInfinite(this.io) && (cost.getIo() != 0) && !Double.isInfinite(cost.getIo())) { d *= this.io / cost.getIo(); ++n; } if (n == 0) { return 1.0; } return Math.pow(d, 1 / n); }
public RelOptCost minus(RelOptCost other) { if (this == INFINITY) { return this; } return new HiveCost(this.rowCount - other.getRows(), this.cpu - other.getCpu(), this.io - other.getIo()); }
public RelOptCost minus(RelOptCost other) { if (this == INFINITY) { return this; } return new HiveCost(this.rowCount - other.getRows(), this.cpu - other.getCpu(), this.io - other.getIo()); }
public boolean isLe(RelOptCost other) { if ( (this.cpu + this.io < other.getCpu() + other.getIo()) || ((this.cpu + this.io == other.getCpu() + other.getIo()) && (this.rowCount <= other.getRows()))) { return true; } return false; }
public RelOptCost plus(RelOptCost other) { if ((this == INFINITY) || (other.isInfinite())) { return INFINITY; } return new HiveCost(this.rowCount + other.getRows(), this.cpu + other.getCpu(), this.io + other.getIo()); }
public boolean isLe(RelOptCost other) { if ( (this.cpu + this.io < other.getCpu() + other.getIo()) || ((this.cpu + this.io == other.getCpu() + other.getIo()) && (this.rowCount <= other.getRows()))) { return true; } return false; }
@Override public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) { RelOptCost relOptCost = super.computeSelfCost(planner, mq).multiplyBy(0.05); return planner.getCostFactory().makeCost(relOptCost.getRows(), 0, 0); }
public RelOptCost plus(RelOptCost other) { if ((this == INFINITY) || (other.isInfinite())) { return INFINITY; } return new HiveCost(this.rowCount + other.getRows(), this.cpu + other.getCpu(), this.io + other.getIo()); }
/** * Since the project under aggregate maybe reduce expressions by {@link org.apache.kylin.query.optrule.AggregateProjectReduceRule}, * consider the count of expressions into cost, the reduced project will be used. * * Made RexOver much more expensive so we can transform into {@link org.apache.kylin.query.relnode.OLAPWindowRel} * by rules in {@link org.apache.calcite.rel.rules.ProjectToWindowRule} */ @Override public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) { boolean hasRexOver = RexOver.containsOver(getProjects(), null); RelOptCost relOptCost = super.computeSelfCost(planner, mq).multiplyBy(.05) .multiplyBy(getProjects().size() * (hasRexOver ? 50 : 1)) .plus(planner.getCostFactory().makeCost(0.1 * caseCount, 0, 0)); return planner.getCostFactory().makeCost(relOptCost.getRows(), 0, 0); }
public boolean isLt(RelOptCost other) { return getRows() < other.getRows(); }
public boolean equals(RelOptCost other) { return getRows() == other.getRows(); }
/** * Converts a cost to a scalar quantity. */ private double toDouble(RelOptCost cost) { if (cost.isInfinite()) { return 1e+30; } else { return cost.getCpu() + cost.getRows() + cost.getIo(); } }
public boolean isLe(RelOptCost other) { if ( (this.cpu + this.io < other.getCpu() + other.getIo()) || ((this.cpu + this.io == other.getCpu() + other.getIo()) && (this.rowCount <= other.getRows()))) { return true; } return false; }
@Override public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) { RelOptCost relOptCost = super.computeSelfCost(planner, mq).multiplyBy(0.05); return planner.getCostFactory().makeCost(relOptCost.getRows(), 0, 0); }
@Override public double getCostForParallelization() { RelOptCost cost = computeSelfCost(getCluster().getPlanner(), getCluster().getMetadataQuery()); double costForParallelization = Math.max(cost.getRows(), 1); PlannerSettings settings = PrelUtil.getSettings(getCluster()); if (settings.useMinimumCostPerSplit()) { double minCostPerSplit = settings.getMinimumCostPerSplit(getPluginId().getType()); costForParallelization = Math.max(costForParallelization, minCostPerSplit * tableMetadata.getSplitCount()); } return costForParallelization; } }