forked from apache/calcite
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CALCITE-2970] Add AbstractConverter only between derived and require…
…d traitset Before this patch, the VolcanoPlanner couldn't distinguish traitset derived from child operators and traitset required by parent operators. AbstractConverters are added between all of these traitsets no matter it is derived or required, which causes the explosion of search space. e.g. SELECT a,b,c,max(d) FROM foo GROUP BY a,b,c; Aggregate +-- TableScan For distributed system, suppose the Aggregate operator may require the following traitsets from TableScan with exact match: - Singleton distribution - Hash distribution on a - Hash distribution on b - Hash distribution on c - Hash distribution on a,b - Hash distribution on b,c - Hash distribution on a,c - Hash distribution on a,b,c VolcanoPlanner would add 7*7+8 = 57 abstract converters into the RelSet, e.g. abstractConverter between [a] and [b,c], even if the satisfying match is allowed, e.g. distribution on [a] statisfy distribution on [a,b,c], there are still lots of abstract converters. But we only need 8. This patch fixes above issue by adding state to RelSubset indicating whether the added traitset is required or derived. The traitset can be both required and derived. Only abstract converter from derived traitset to required traitset is added. By default, when adding a new RelNode to RelSet, we treat its traitset as derived, when calling changeTraits, the traitset will be treated as required. Unfortunately, almost all the RelNodes except AbstractConverter are added through rule transformation, when the AbstractConverter is transformed to a enforcing operator, e.g. PhysicalSort, the planner will still treat its traitset as derived, which will trigger the creation of AbstractConverter between this RelSubset and remaining RelSubsets in the RelSet. To avoid this issue, though not clean but work, enforcing operator and AbstactConverter should override isEnforcer() method to indicate the RelNode is added due to the desired traitset is not satisfied. The user needs to judge by his/her own whether to mark enforcing operator. Close apache#1860
- Loading branch information
Showing
17 changed files
with
211 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.