Vladimir Ozerov created CALCITE-4466: ----------------------------------------
Summary: Do not RelTraitDef.convert if the "from" trait already satisfies the "to" trait. Key: CALCITE-4466 URL: https://issues.apache.org/jira/browse/CALCITE-4466 Project: Calcite Issue Type: Task Components: core Affects Versions: 1.26.0 Reporter: Vladimir Ozerov Assignee: Vladimir Ozerov Fix For: 1.27.0 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)}}. -- This message was sent by Atlassian Jira (v8.3.4#803005)