Sorry the documentation isn’t clear, but read the code. It doesn’t remove identical projections so that ProjectRemoveRule can do it instead.
ProjectMergeRule has a boolean “force" flag that will cause it to remove even if projections are identical. If you use RelBuilder to build the tree, a lot of these optimizations will happen automatically as you build the tree, so you may not even need this rule if your use case is just “building” and not “optimizing”. Julian > On Feb 12, 2019, at 12:51 PM, Homer <[email protected]> wrote: > > Hi > > The ProjectMergeRule > <https://calcite.apache.org/apidocs/org/apache/calcite/rel/rules/ProjectMergeRule.html> > specifies the following > > ProjectMergeRule merges a |Project| > <https://calcite.apache.org/apidocs/org/apache/calcite/rel/core/Project.html> > into another |Project| > <https://calcite.apache.org/apidocs/org/apache/calcite/rel/core/Project.html>, > provided the projects aren't projecting identical sets of input references. > > I would like to get rid of identical projection in a plan, but this rule > specifically doesn't remove identical projections > > i am wondering if there is a standard rule that will remove identical > projections. > > Also curious why we dont want to merge identical rules in the > ProjectMergeRule case? > > thanks
