danny0405 commented on a change in pull request #1584: [CALCITE-3503] NPE at 
VolcanoPlanner#isValid when DEBUG is enabled
URL: https://github.com/apache/calcite/pull/1584#discussion_r347069363
 
 

 ##########
 File path: 
core/src/main/java/org/apache/calcite/plan/volcano/VolcanoPlanner.java
 ##########
 @@ -877,6 +877,10 @@ public RelSubset ensureRegistered(RelNode rel, RelNode 
equivRel) {
    * Checks internal consistency.
    */
   protected boolean isValid(Litmus litmus) {
+    if (this.getRoot() == null) {
+      return true;
 
 Review comment:
   BTW, this code 
`this.getRoot().getCluster().getMetadataQuerySupplier().get()` confused me a 
lot, can you please explain why we need a fresh new `RelMetadataQuery` instance 
here ? Couldn't we use the instance already existing there with 
`RelOptCluster#getMetadataQuery` ? (I have checked that almost each `isValid` 
case is in the `RelOptRuleCall` circle).
   
   Even we have to got a fresh new instance here, why we just add a new 
interface `RelOptCluster#getMetadataQuerySupplier` just for debugging ? Can you 
refactor that out ?

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