calcite
calcite copied to clipboard
[CALCITE-4428] Remove the equiv rel from mapRel2Subset when merging set (Jiatao Tao)
Previous in #2222, we will skip the origin rule match when rel has been removed from its subset, but this implement calls subset.getRelList() and it has a performance issue. The correct way to do this is to remove the subset from mapRel2Subset.
We can use TpchTest#testQuery07 can directly reproduce the situation that #2222 wanted to fix. Put this in VolcanoRuleCall#match, delete the previous code, and run the test, we can see the prints are full of the console(about 8k+). So I think still it is necessary to do it, it can avoid lots of unless rule match.
if (subset != rel && !subset.getRelList().contains(rel)) {
System.out.println("Rule [{}] not fired because operand #{} ({}) belongs to obsolete set");;
}
@julianhyde @vlsi Could you help review this pr.
@Aaaaaaron , it is really sad when the review takes way more time than doing the same thing on my own.
This PR has 3 changes:
- revert 2222. I fully agree
- map.remove. The change is wrong.
- checkDuplicateSubsets. The change is wrong.
That is really demotivating.
Could you explain a bit why "map.remove. The change is wrong." and which way is right? Really thanks. @vlsi
@julianhyde Would you help to review this PR? Thanks a lot.