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

Do not RelTraitDef.convert if the "from" trait already satisfies the "to" trait.

    XMLWordPrintableJSON

Details

    Description

      Consider that we have two trait defs A_def and B_def. We have a node with the trait set [A_from, B_from] that we want to convert to a node with the traits set [A_to, B_to]. Suppose that:

      • A_from.satisfies(A_to) = false
      • B_from.satisfies(B_to) = true

      Currently, the VolcanoPlanner will invoke convert on both A_trait and B_trait, because it skips the conversion only when two traits are equal. In our example, it will lead to an unnecessary call to B_def.convert(node, B_to). This is not a big problem but it forces implementors of custom traits to double-check whether the passed node already satisfies the required trait or not.

      The proposal is to replace fromTrait.equals(toTrait) with fromTrait.satisfies(toTrait).

      Attachments

        Issue Links

          Activity

            People

              vozerov Vladimir Ozerov
              vozerov Vladimir Ozerov
              Votes:
              0 Vote for this issue
              Watchers:
              4 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 - 3h 20m
                  3h 20m