Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-4578

redundant HepPlanner#buildFinalPlan when there's no rule fired in the program

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • core
    • None

    Description

      Example like that: insert xxx VALUES (1, 'one'), (2, 'two'), (3, 'three')...(10000, 'ten thousand');

      It generates a Union node with 10000 inputs, and the performance is poor, here's the profile:

      We create a program(HepProgram) to do the union merge, in this case, we only have one union, so the rule is not fired, but it will still build the buildFinalPlan, and AbstractRelNode#explain has performance issue in this case(see the flame graph):

      public RelNode findBestExp() {
        assert root != null;
      
        executeProgram(mainProgram);
      
        // Get rid of everything except what's in the final plan.
        collectGarbage();
      
        return buildFinalPlan(root);
      }
      

      And the union has large inputs, so the performance is poor(in SetOp#replaceInput, we have to recomputeDigest ), we can skip buildFinalPlan if there's no rule fired.
       
       

      Attachments

        Activity

          People

            Aron.tao Jiatao Tao
            Aron.tao Jiatao Tao
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated: