Skip to content

Commit

Permalink
[CALCITE-3753] Remove rule queue importance
Browse files Browse the repository at this point in the history
Since we are going to execute all the rules anyway, sorting the rule matches
will do more harm than good.

Also removed ambitious and impatient mode. User could override checkCancel and
throw VolcanoTimeoutException when appropriate (i.e. exceed 60 seconds, exceed
1000 ticks etc.) so that the VolcanoPlanner will stop exhaustive searching and
return the best plan so far.

Close apache#1840
  • Loading branch information
hsyuan committed Mar 9, 2020
1 parent 4208d0b commit 80e6b02
Show file tree
Hide file tree
Showing 24 changed files with 180 additions and 850 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,11 @@ public JdbcSort(
offset, fetch);
}

@Override public RelOptCost computeSelfCost(RelOptPlanner planner,
RelMetadataQuery mq) {
return super.computeSelfCost(planner, mq).multiplyBy(0.9);
}

public JdbcImplementor.Result implement(JdbcImplementor implementor) {
return implementor.implement(this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public abstract class AbstractRelOptPlanner implements RelOptPlanner {

private Pattern ruleDescExclusionFilter;

private final AtomicBoolean cancelFlag;
protected final AtomicBoolean cancelFlag;

private final Set<Class<? extends RelNode>> classes = new HashSet<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,6 @@ void mergeWith(

// merge subsets
for (RelSubset otherSubset : otherSet.subsets) {
planner.ruleQueue.subsetImportances.remove(otherSubset);
RelSubset subset =
getOrCreateSubset(
otherSubset.getCluster(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,7 @@ void propagateCostImprovements0(VolcanoPlanner planner, RelMetadataQuery mq,
// since best was changed, cached metadata for this subset should be removed
mq.clearCache(this);

// Recompute subset's importance and propagate cost change to parents
planner.ruleQueue.recompute(this);
// Propagate cost change to parents
for (RelNode parent : getParents()) {
// removes parent cached metadata since its input was changed
mq.clearCache(parent);
Expand All @@ -386,18 +385,6 @@ void propagateCostImprovements0(VolcanoPlanner planner, RelMetadataQuery mq,
}
}

public void propagateBoostRemoval(VolcanoPlanner planner) {
planner.ruleQueue.recompute(this);

if (boosted) {
boosted = false;

for (RelSubset parentSubset : getParentSubsets(planner)) {
parentSubset.propagateBoostRemoval(planner);
}
}
}

@Override public void collectVariablesUsed(Set<CorrelationId> variableSet) {
variableSet.addAll(set.variablesUsed);
}
Expand Down
Loading

0 comments on commit 80e6b02

Please sign in to comment.