This is an automated email from the ASF dual-hosted git repository.
mbudiu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/calcite.git
The following commit(s) were added to refs/heads/main by this push:
new c3f39b276b Following [CALCITE-6462] Clarify comments
c3f39b276b is described below
commit c3f39b276b394bc84592ae263e353b226cbb9c4d
Author: caicancai <[email protected]>
AuthorDate: Tue Jul 16 23:11:33 2024 +0800
Following [CALCITE-6462] Clarify comments
---
.../apache/calcite/plan/volcano/VolcanoPlanner.java | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git
a/core/src/main/java/org/apache/calcite/plan/volcano/VolcanoPlanner.java
b/core/src/main/java/org/apache/calcite/plan/volcano/VolcanoPlanner.java
index 1ccb4b0fae..0c22d03820 100644
--- a/core/src/main/java/org/apache/calcite/plan/volcano/VolcanoPlanner.java
+++ b/core/src/main/java/org/apache/calcite/plan/volcano/VolcanoPlanner.java
@@ -988,15 +988,15 @@ public class VolcanoPlanner extends AbstractRelOptPlanner
{
continue;
}
- // Update the RelNode's cost when we find that the cost is changed.
- //
- // Why do we need to update it?
- // When RelSet's one of the subsets find a cheaper RelNode, we need to
update the
- // parents of the subset to have the best RelNode and best cost.
- // In theory, this cost will become smaller, But according to
- // the SQL we added in the JdbcAdapterTest {@link
testVolcanoPlannerInternalValid},
- // it shows RelNode's cost will become bigger sometimes.
- // So we update it.
+ // The cost of the RelNode is updated when a change is detected.
+
+ // The reason for this update is that when one of the subsets in
RelSet finds a RelNode
+ // with a lower cost, it is necessary to update the parents of the
subset to
+ // have the best RelNode and best cost.
+ // In theory, this cost should become smaller.
+ // However, according to the SQL added in the JdbcAdapterTest {@link
testVolcanoPlannerInternalValid},
+ // it is observed that the cost of RelNode can sometimes increase.
+ // Therefore, an update is performed.
if (relNode == subset.best && cost.equals(subset.bestCost)) {
continue;
}