Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hash key changes #13

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ static class CityHash128Key implements java.io.Serializable {
* Always refresh SerialVersionUID when prompted
*/
private static final long serialVersionUID = 166788428640603097L;
String unhashedString;
private long[] segments;
private int hashCode;

Expand All @@ -138,6 +139,7 @@ static class CityHash128Key implements java.io.Serializable {
}

CityHash128Key(String s) {
unhashedString = s;
byte[] bytes = new byte[s.length()];
s.getBytes(0, s.length(), bytes, 0);
segments = CityHash.cityHash128(bytes, 0, bytes.length);
Expand All @@ -147,7 +149,8 @@ public boolean equals(Object obj) {
if (!(obj instanceof CityHash128Key))
return false;

return java.util.Arrays.equals(segments, ((CityHash128Key) obj).segments);
return (java.util.Arrays.equals(segments, ((CityHash128Key) obj).segments)//checks if hash is equal, short-circuitting;
&& this.unhashedString.equals(((CityHash128Key) obj).unhashedString));//checks if string is equal
}

public int hashCode() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ String getClassNameInternal() {
userSQL = parsedSQL.processedSQL;
userSQLParamPositions = parsedSQL.parameterPositions;
initParams(userSQLParamPositions.length);
useBulkCopyForBatchInsert = conn.getUseBulkCopyForBatchInsert();
}

/**
Expand Down