drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paul-rogers <...@git.apache.org>
Subject [GitHub] drill pull request #797: DRILL-5286: No need to convert when the relNode and...
Date Sat, 25 Mar 2017 23:46:30 GMT
Github user paul-rogers commented on a diff in the pull request:

    --- 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 --
    Does this work? A hash map depends on `hashCode()` and `equals()`. A random check of one
`DrillRelNode`, `DrillFilterRelBase`, shows that the above two methods are not implemented.
As a result, set membership may be based on object identity. But, surely each call to `convert()`
will create a new object?
    Or, does this rule apply to only certain kinds of nodes which do have `hashCode()` and
`equals()` implemented? If so, perhaps add some comments to identify the subtree of nodes
with which this code works.
    Do we have a test case for this code? Or, did you step through it to see if it was doing
what we want? If so, and it worked, then likely this code does work with a specific subset
of nodes that have the needed methods.

If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.

View raw message