hawq-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mgoddard-pivotal <...@git.apache.org>
Subject [GitHub] incubator-hawq pull request #1365: Adding equals() to Fragment, to facilitat...
Date Tue, 15 May 2018 23:54:12 GMT
Github user mgoddard-pivotal commented on a diff in the pull request:

    https://github.com/apache/incubator-hawq/pull/1365#discussion_r188469685
  
    --- Diff: pxf/pxf-api/src/main/java/org/apache/hawq/pxf/api/Fragment.java ---
    @@ -140,4 +142,48 @@ public String getProfile() {
         public void setProfile(String profile) {
             this.profile = profile;
         }
    +
    +	@Override
    +	public int hashCode() {
    +		final int prime = 31;
    +		int result = 1;
    +		result = prime * result + index;
    +		result = prime * result + Arrays.hashCode(metadata);
    +		result = prime * result + ((profile == null) ? 0 : profile.hashCode());
    +		result = prime * result + Arrays.hashCode(replicas);
    +		result = prime * result + ((sourceName == null) ? 0 : sourceName.hashCode());
    +		result = prime * result + Arrays.hashCode(userData);
    +		return result;
    +	}
    +
    +	@Override
    +	public boolean equals(Object obj) {
    --- End diff --
    
    Well, I just had my IDE, Eclipse, generate these two methods for me.  Line 161 does what
you have listed there, your top line.  Line 165 performs the same check you have there as
`if (o instancef Point) {`, then `obj` is cast as Fragment on line 167.  The remainder of
the logic you have within the complex `... && ...` statement is equivalently expressed
in the remaining checks, but within the `if ... else if ... else` clauses.  Is your comment
meant to point out an issue with correctness, or more of an aesthetic issue?


---

Mime
View raw message