laurentgo commented on a change in pull request #1207: [CALCITE-3062] Do not 
populate provenanceMap if not debug
URL: https://github.com/apache/calcite/pull/1207#discussion_r284092160
 
 

 ##########
 File path: 
core/src/main/java/org/apache/calcite/plan/volcano/VolcanoPlanner.java
 ##########
 @@ -276,6 +276,9 @@ public VolcanoPlanner(RelOptCostFactory costFactory, //
     super(costFactory == null ? VolcanoCost.FACTORY : costFactory, //
         externalContext);
     this.zeroCost = this.costFactory.makeZeroCost();
+    // If LOGGER is debug enabled, enable provenance information to be captured
+    this.provenanceMap = LOGGER.isDebugEnabled() ? new HashMap<>()
+        : Util.blackholeMap();
 
 Review comment:
   - all the put variants need to be overriden, so at that point it's probably 
simpler to subclass AbstractMap (which is what blackhole map does).
   - blackhole map is explicit about its behavior (vs an anonymous inner 
class). When debugging, you know what provenanceMap behavior is just by looking 
at the class name.
   - logger level can be changing during planning externally, so better to only 
check once the level vs doing it each time `put` is used (and possibly ending 
up with a partial map)

----------------------------------------------------------------
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]


With regards,
Apache Git Services

Reply via email to