You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by laurentgo <gi...@git.apache.org> on 2016/02/05 23:08:45 UTC

[GitHub] drill pull request: DRILL-4359: Adds equals/hashCode methods to En...

GitHub user laurentgo opened a pull request:

    https://github.com/apache/drill/pull/363

    DRILL-4359: Adds equals/hashCode methods to EndpointAffinity

    Adds equals/hashCode methods to EndpointAffinity to allow for comparison in tests.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/laurentgo/drill laurent/adds-equals-to-endpoint-affinity

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/drill/pull/363.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #363
    
----
commit 80954145733c4b6f6ce5cce8cb40dfba29aa899c
Author: Laurent Goujon <la...@dremio.com>
Date:   2016-02-05T22:06:00Z

    DRILL-4359: Adds equals/hashCode methods to EndpointAffinity
    
    Adds equals/hashCode methods to EndpointAffinity to allow for comparison in
    tests.

----


---
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.
---

[GitHub] drill pull request: DRILL-4359: Adds equals/hashCode methods to En...

Posted by jaltekruse <gi...@git.apache.org>.
Github user jaltekruse commented on a diff in the pull request:

    https://github.com/apache/drill/pull/363#discussion_r52080108
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/physical/EndpointAffinity.java ---
    @@ -96,6 +96,42 @@ public boolean isAssignmentRequired() {
       }
     
       @Override
    +  public int hashCode() {
    +    final int prime = 31;
    +    int result = 1;
    +    long temp;
    +    temp = Double.doubleToLongBits(affinity);
    +    result = prime * result + (int) (temp ^ (temp >>> 32));
    +    result = prime * result + ((endpoint == null) ? 0 : endpoint.hashCode());
    +    return result;
    +  }
    +
    +  @Override
    +  public boolean equals(Object obj) {
    +    if (this == obj) {
    +      return true;
    +    }
    +    if (obj == null) {
    +      return false;
    +    }
    +    if (!(obj instanceof EndpointAffinity)) {
    +      return false;
    +    }
    +    EndpointAffinity other = (EndpointAffinity) obj;
    +    if (Double.doubleToLongBits(affinity) != Double.doubleToLongBits(other.affinity)) {
    +      return false;
    +    }
    +    if (endpoint == null) {
    +      if (other.endpoint != null) {
    +        return false;
    +      }
    +    } else if (!endpoint.equals(other.endpoint)) {
    --- End diff --
    
    It looks like DrillbitEndpoint also lacks equals and hashcode methods, are these going to be necessary for your tests as well?


---
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.
---

[GitHub] drill pull request: DRILL-4359: Adds equals/hashCode methods to En...

Posted by jaltekruse <gi...@git.apache.org>.
Github user jaltekruse commented on a diff in the pull request:

    https://github.com/apache/drill/pull/363#discussion_r52084085
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/physical/EndpointAffinity.java ---
    @@ -96,6 +96,42 @@ public boolean isAssignmentRequired() {
       }
     
       @Override
    +  public int hashCode() {
    +    final int prime = 31;
    +    int result = 1;
    +    long temp;
    +    temp = Double.doubleToLongBits(affinity);
    +    result = prime * result + (int) (temp ^ (temp >>> 32));
    +    result = prime * result + ((endpoint == null) ? 0 : endpoint.hashCode());
    +    return result;
    +  }
    +
    +  @Override
    +  public boolean equals(Object obj) {
    +    if (this == obj) {
    +      return true;
    +    }
    +    if (obj == null) {
    +      return false;
    +    }
    +    if (!(obj instanceof EndpointAffinity)) {
    +      return false;
    +    }
    +    EndpointAffinity other = (EndpointAffinity) obj;
    +    if (Double.doubleToLongBits(affinity) != Double.doubleToLongBits(other.affinity)) {
    +      return false;
    +    }
    +    if (endpoint == null) {
    +      if (other.endpoint != null) {
    +        return false;
    +      }
    +    } else if (!endpoint.equals(other.endpoint)) {
    --- End diff --
    
    I should have looked more carefully, I was looking at the one in the proto.beans package, but that isn't being used here.


---
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.
---

[GitHub] drill pull request: DRILL-4359: Adds equals/hashCode methods to En...

Posted by laurentgo <gi...@git.apache.org>.
Github user laurentgo commented on a diff in the pull request:

    https://github.com/apache/drill/pull/363#discussion_r52083113
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/physical/EndpointAffinity.java ---
    @@ -96,6 +96,42 @@ public boolean isAssignmentRequired() {
       }
     
       @Override
    +  public int hashCode() {
    +    final int prime = 31;
    +    int result = 1;
    +    long temp;
    +    temp = Double.doubleToLongBits(affinity);
    +    result = prime * result + (int) (temp ^ (temp >>> 32));
    +    result = prime * result + ((endpoint == null) ? 0 : endpoint.hashCode());
    +    return result;
    +  }
    +
    +  @Override
    +  public boolean equals(Object obj) {
    +    if (this == obj) {
    +      return true;
    +    }
    +    if (obj == null) {
    +      return false;
    +    }
    +    if (!(obj instanceof EndpointAffinity)) {
    +      return false;
    +    }
    +    EndpointAffinity other = (EndpointAffinity) obj;
    +    if (Double.doubleToLongBits(affinity) != Double.doubleToLongBits(other.affinity)) {
    +      return false;
    +    }
    +    if (endpoint == null) {
    +      if (other.endpoint != null) {
    +        return false;
    +      }
    +    } else if (!endpoint.equals(other.endpoint)) {
    --- End diff --
    
    DrillbitEndpoint is a protobuf Message, so the equals/hashCode methods are provided by protobuf API (by AbstractMessage if I'm correct)


---
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.
---

[GitHub] drill pull request: DRILL-4359: Adds equals/hashCode methods to En...

Posted by jaltekruse <gi...@git.apache.org>.
Github user jaltekruse commented on the pull request:

    https://github.com/apache/drill/pull/363#issuecomment-181638228
  
    +1


---
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.
---

[GitHub] drill pull request: DRILL-4359: Adds equals/hashCode methods to En...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/drill/pull/363


---
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.
---