[
https://issues.apache.org/jira/browse/DRILL-5286?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15942682#comment-15942682
]
ASF GitHub Bot commented on DRILL-5286:
---------------------------------------
Github user paul-rogers commented on a diff in the pull request:
https://github.com/apache/drill/pull/797#discussion_r108094902
--- Diff:
exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/SubsetTransformer.java
---
@@ -45,15 +48,20 @@ public RelTraitSet newTraitSet(RelTrait... traits) {
}
- boolean go(T n, RelNode candidateSet) throws E {
+ public boolean go(T n, RelNode candidateSet) throws E {
if ( !(candidateSet instanceof RelSubset) ) {
return false;
}
boolean transform = false;
+ Set<RelNode> transformedRels = Sets.newHashSet();
for (RelNode rel : ((RelSubset)candidateSet).getRelList()) {
if (isPhysical(rel)) {
RelNode newRel = RelOptRule.convert(candidateSet,
rel.getTraitSet().plus(Prel.DRILL_PHYSICAL));
+ if(transformedRels.contains(newRel)) {
--- End diff --
No doubt that time can be saved by avoiding repeated work. When I was
tinkering with some Calcite rules I saw the same node being analyzed many, many
times for even a simple query.
Since you want to use identify (not equality) to compare hash map entries,
consider using `Sets.newIdentityHashSet()` in place of the equality-based
`Sets.newHashSet()`.
More efficient would be if we knew the type of the `RelNode`s. If we did,
and they all derive from a single Drill type, we could just add an
`isTransformed` flag to avoid the set overhead.
> When rel and target candidate set is the same, planner should not need to do
> convert for the relNode since it must have been done
> ---------------------------------------------------------------------------------------------------------------------------------
>
> Key: DRILL-5286
> URL: https://issues.apache.org/jira/browse/DRILL-5286
> Project: Apache Drill
> Issue Type: Bug
> Reporter: Chunhui Shi
> Assignee: Chunhui Shi
>
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)