You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Vladimir Ozerov (Jira)" <ji...@apache.org> on 2021/01/13 15:50:00 UTC
[jira] [Updated] (CALCITE-4466) Do not RelTraitDef.convert if the
"from" trait already satisfies the "to" trait.
[ https://issues.apache.org/jira/browse/CALCITE-4466?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Vladimir Ozerov updated CALCITE-4466:
-------------------------------------
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)}}.
was:
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)}}.
> 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
> Priority: Minor
> 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)