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_r347068970
##########
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:
I don't think so, at least these cases would invoke the `isValid`:
* When user change the node traits manually [1]
* When we generate a new node in the planner rule and register it into the
planner [2]
* Some explicit invocation of the node registration
[1]
https://github.com/apache/calcite/blob/301bbe9e132346f60587e8c21c474f7c51b236c3/core/src/main/java/org/apache/calcite/plan/RelOptRule.java#L568
[2]
https://github.com/apache/calcite/blob/301bbe9e132346f60587e8c21c474f7c51b236c3/core/src/main/java/org/apache/calcite/plan/volcano/VolcanoRuleCall.java#L132
[3]
https://github.com/apache/calcite/blob/301bbe9e132346f60587e8c21c474f7c51b236c3/core/src/main/java/org/apache/calcite/rel/rules/JoinCommuteRule.java#L176
----------------------------------------------------------------
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