Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id BFECA200C51 for ; Sun, 26 Mar 2017 00:46:39 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id BE87E160B96; Sat, 25 Mar 2017 23:46:39 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 12DCB160B88 for ; Sun, 26 Mar 2017 00:46:38 +0100 (CET) Received: (qmail 90682 invoked by uid 500); 25 Mar 2017 23:46:30 -0000 Mailing-List: contact dev-help@drill.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@drill.apache.org Delivered-To: mailing list dev@drill.apache.org Received: (qmail 90671 invoked by uid 99); 25 Mar 2017 23:46:30 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 25 Mar 2017 23:46:30 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 82BCCDFE7B; Sat, 25 Mar 2017 23:46:30 +0000 (UTC) From: paul-rogers To: dev@drill.apache.org Reply-To: dev@drill.apache.org References: In-Reply-To: Subject: [GitHub] drill pull request #797: DRILL-5286: No need to convert when the relNode and... Content-Type: text/plain Message-Id: <20170325234630.82BCCDFE7B@git1-us-west.apache.org> Date: Sat, 25 Mar 2017 23:46:30 +0000 (UTC) archived-at: Sat, 25 Mar 2017 23:46:39 -0000 Github user paul-rogers commented on a diff in the pull request: https://github.com/apache/drill/pull/797#discussion_r108048071 --- 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 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. ---