Uses multi-methods to fire the right rule for each type of relational expression. This allows the transformer to be extended without having to add a new method to RelNode, and without requiring a collection of rule classes scattered to the four winds.
REVIEW: jhyde, 2009/7/28: Is sql2rel the correct package for this class? Trimming fields is not an essential part of SQL-to-Rel translation, and arguably belongs in the optimization phase. But this transformer does not obey the usual pattern for planner rules; it is difficult to do so, because each {@link RelNode} needs to return a different set of fields aftertrimming.
TODO: Change 2nd arg of the {@link #trimFields} method from BitSet toMapping. Sometimes it helps the consumer if you return the columns in a particular order. For instance, it may avoid a project at the top of the tree just for reordering. Could ease the transition by writing methods that convert BitSet to Mapping and vice versa.
|
|