calcite icon indicating copy to clipboard operation
calcite copied to clipboard

[CALCITE-4428] Remove the equiv rel from mapRel2Subset when merging set (Jiatao Tao)

Open Aaaaaaron opened this issue 4 years ago • 3 comments

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 avatar Dec 04 '20 08:12 Aaaaaaron

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

  1. revert 2222. I fully agree
  2. map.remove. The change is wrong.
  3. checkDuplicateSubsets. The change is wrong.

That is really demotivating.

vlsi avatar Dec 06 '20 10:12 vlsi

Could you explain a bit why "map.remove. The change is wrong." and which way is right? Really thanks. @vlsi

Aaaaaaron avatar Dec 07 '20 02:12 Aaaaaaron

@julianhyde Would you help to review this PR? Thanks a lot.

Aaaaaaron avatar Dec 08 '20 02:12 Aaaaaaron