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

Add separate rules for "AggregateUnionAggregateRule" to reduce potential matching cost in VolcanoPlanner

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.13.0
    • 1.16.0
    • core
    • None

    Description

      Problem: when optimize some sql (has Union + Aggregate pattern) based on VolcanoPlanner may take a long time(tens of seconds or a few minutes).
      After adding the time cost statistics for each rule during the optimization phase, I found that "AggregateUnionAggregateRule" has a large value, but the query pattern will not be matched finally.
      So I try to make a minor change for AggregateUnionAggregateRule and the statistics shows a improvement for the same query be tested. (see the attached image)

      1. Current AggregateUnionAggregateRule's match pattern:

               topAgg
                  |    
                Union
              /        \
           Rel        Rel
      

      2. Real patterns that can possibly be matched:

               topAgg
                  |    
                Union
              /     \
      bottomAgg      Rel
      

      Or

               topAgg
                  |    
                Union
              /        \
          Rel      bottomAgg
      

      Will this change reasonable? (BTW, would it be useful to add some time cost statistics to VolcanoPlanner like the attached image below? I saw a CalciteTimingTracer class and getSqlTimingTracer() in CalciteTracer but not used.)

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            julianhyde Julian Hyde
            lincoln.86xy lincoln lee
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment