hbtoo commented on a change in pull request #2187:
URL: https://github.com/apache/calcite/pull/2187#discussion_r503026189



##########
File path: 
core/src/main/java/org/apache/calcite/plan/volcano/VolcanoPlanner.java
##########
@@ -906,6 +903,67 @@ void rename(RelNode rel) {
     }
   }
 
+  /**
+   * Checks whether a relexp has made any subset cheaper, and if it so,
+   * propagate new cost to parent rel nodes.
+   *
+   * @param rel       Relational expression whose cost has improved
+   */
+  void propagateCostImprovements(RelNode rel) {
+    RelMetadataQuery mq = rel.getCluster().getMetadataQuery();
+    Map<RelNode, RelOptCost> propagateRels = new HashMap<>();
+    PriorityQueue<RelNode> propagateHeap = new PriorityQueue<>((o1, o2) -> {
+      RelOptCost c1 = propagateRels.get(o1);

Review comment:
       If you consider cost as a kind of distance between relnodes/subsets, 
this propagation process is basically Dijkstra in a directed graph. Computing 
the best plan in this directed graph is finding the "shortest" path. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to