This is an automated email from the ASF dual-hosted git repository.

mihaibudiu 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 111030383c [CALCITE-7504] The Hypergraph code does not use lazy logging
111030383c is described below

commit 111030383c66ec44317abbc8574606c329df9362
Author: Mihai Budiu <[email protected]>
AuthorDate: Fri May 8 16:58:43 2026 -0700

    [CALCITE-7504] The Hypergraph code does not use lazy logging
    
    Signed-off-by: Mihai Budiu <[email protected]>
---
 .../java/org/apache/calcite/rel/rules/DpHyp.java   | 34 +++++++++++++---------
 1 file changed, 20 insertions(+), 14 deletions(-)

diff --git a/core/src/main/java/org/apache/calcite/rel/rules/DpHyp.java 
b/core/src/main/java/org/apache/calcite/rel/rules/DpHyp.java
index 3fc16e1a66..10402db68e 100644
--- a/core/src/main/java/org/apache/calcite/rel/rules/DpHyp.java
+++ b/core/src/main/java/org/apache/calcite/rel/rules/DpHyp.java
@@ -86,9 +86,10 @@ public void startEnumerateJoin() {
     int size = hyperGraph.getInputs().size();
     for (int i = 0; i < size; i++) {
       long singleNode = LongBitmap.newBitmap(i);
-      LOGGER.debug("Initialize the dp table. Node {{}} is:\n {}",
-          i,
-          RelOptUtil.toString(hyperGraph.getInput(i)));
+      if (LOGGER.isDebugEnabled()) {
+        LOGGER.debug("Initialize the dp table. Node {{}} is:\n {}", i,
+            RelOptUtil.toString(hyperGraph.getInput(i)));
+      }
       dpTable.put(singleNode, hyperGraph.getInput(i));
       resultInputOrder.put(
           singleNode,
@@ -280,15 +281,17 @@ private void emitCsgCmp(long csg, long cmp, 
List<HyperEdge> edges) {
         winOrder = ImmutableList.copyOf(unionOrder);
       }
     }
-    LOGGER.debug("Found set {} and {}, connected by condition {}. [cost={}, 
rows={}]",
-        LongBitmap.printBitmap(csg),
-        LongBitmap.printBitmap(cmp),
-        RexUtil.composeConjunction(
-            builder.getRexBuilder(),
-            edges.stream()
-                .map(edge -> 
edge.getCondition()).collect(Collectors.toList())),
-        mq.getCumulativeCost(winPlan),
-        mq.getRowCount(winPlan));
+    if (LOGGER.isDebugEnabled()) {
+      LOGGER.debug("Found set {} and {}, connected by condition {}. [cost={}, 
rows={}]",
+          LongBitmap.printBitmap(csg),
+          LongBitmap.printBitmap(cmp),
+          RexUtil.composeConjunction(
+              builder.getRexBuilder(),
+              edges.stream()
+                  .map(edge -> 
edge.getCondition()).collect(Collectors.toList())),
+          mq.getCumulativeCost(winPlan),
+          mq.getRowCount(winPlan));
+    }
 
     RelNode oriPlan = dpTable.get(csg | cmp);
     boolean dpTableUpdated = true;
@@ -306,7 +309,7 @@ private void emitCsgCmp(long csg, long cmp, List<HyperEdge> 
edges) {
     }
 
     assert winOrder != null;
-    if (dpTableUpdated) {
+    if (dpTableUpdated && LOGGER.isDebugEnabled()) {
       LOGGER.debug("Dp table is updated. The better plan for subgraph {} now 
is:\n {}",
           LongBitmap.printBitmap(csg | cmp),
           RelOptUtil.toString(winPlan));
@@ -323,7 +326,10 @@ private void emitCsgCmp(long csg, long cmp, 
List<HyperEdge> edges) {
       LOGGER.error("The optimal plan was not generated because the enumeration 
ended prematurely");
       return null;
     }
-    LOGGER.debug("Enumeration completed. The best plan is:\n {}", 
RelOptUtil.toString(orderedJoin));
+    if (LOGGER.isDebugEnabled()) {
+      LOGGER.debug("Enumeration completed. The best plan is:\n {}",
+          RelOptUtil.toString(orderedJoin));
+    }
     ImmutableList<HyperGraph.NodeState> resultOrder = 
resultInputOrder.get(wholeGraph);
     assert resultOrder != null && resultOrder.size() == size;
 

Reply via email to