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

Do not generate the new join tree from commute/associate rules if there are "always TRUE" conditions

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.26.0
    • Fix Version/s: 1.27.0
    • Component/s: core

      Description

      JoinCommuteRule and JoinAssociateRule form a complete ruleset to generate all bushy trees (plus join-project transposes to counter new projects created during commute).

      These rules do not check whether the new join trees contain an always TRUE condition which is a cross-product. Such join trees are not optimal in the majority of cases, and practical optimizers might want to suppress them.

      In this ticket, I propose to add a configuration property to JoinCommuteRule and JoinAssociateRule to disable the creation of trees with always TRUE condition:

      1. The property should be disabled by default because sometimes cross-products might be present in the query on purpose (e.g., see https://dl.acm.org/doi/10.5555/645916.671976, page 315)
      2. We consider the "always TRUE" condition only, even though they represent only part of cross-products. The reason is that it might be difficult and expensive to understand whether the condition is cross-join or not (e.g., for hypergraphs). On the other hand, the check for "always true" is cheap and robust. We assume that the user might need to do some pre-processing (e.g., filter push-down) to take advantage of the new property.
      3. We do not extend the JoinPushThroughJoinRule for now, since the [commute + associate] ruleset already explores all bushy trees and testing of the new property for JoinPushThroughJoinRule is difficult. We may extend this rule in a separate ticket if needed.
         

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                vozerov Vladimir Ozerov
                Reporter:
                vozerov Vladimir Ozerov
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 0.5h
                  0.5h