DomGarguilo commented on code in PR #2811:
URL: https://github.com/apache/accumulo/pull/2811#discussion_r978774660
##########
core/src/main/java/org/apache/accumulo/core/data/Key.java:
##########
@@ -975,30 +981,26 @@ public void write(DataOutput out) throws IOException {
* @return true if specified parts of keys match, false otherwise
*/
public boolean equals(Key other, PartialKey part) {
- switch (part) {
- case ROW:
- return isEqual(row, other.row);
- case ROW_COLFAM:
- return isEqual(row, other.row) && isEqual(colFamily, other.colFamily);
- case ROW_COLFAM_COLQUAL:
- return isEqual(row, other.row) && isEqual(colFamily, other.colFamily)
- && isEqual(colQualifier, other.colQualifier);
- case ROW_COLFAM_COLQUAL_COLVIS:
- return isEqual(row, other.row) && isEqual(colFamily, other.colFamily)
- && isEqual(colQualifier, other.colQualifier)
- && isEqual(colVisibility, other.colVisibility);
- case ROW_COLFAM_COLQUAL_COLVIS_TIME:
- return isEqual(row, other.row) && isEqual(colFamily, other.colFamily)
- && isEqual(colQualifier, other.colQualifier)
- && isEqual(colVisibility, other.colVisibility) && timestamp ==
other.timestamp;
- case ROW_COLFAM_COLQUAL_COLVIS_TIME_DEL:
- return isEqual(row, other.row) && isEqual(colFamily, other.colFamily)
- && isEqual(colQualifier, other.colQualifier)
- && isEqual(colVisibility, other.colVisibility) && timestamp ==
other.timestamp
- && deleted == other.deleted;
- default:
- throw new IllegalArgumentException("Unrecognized partial key
specification " + part);
- }
+ boolean result = isEqual(row, other.row);
+ if (part == ROW)
+ return result;
+ result &= isEqual(colFamily, other.colFamily);
+ if (part == ROW_COLFAM)
+ return result;
+ result &= isEqual(colQualifier, other.colQualifier);
+ if (part == ROW_COLFAM_COLQUAL)
+ return result;
+ result &= isEqual(colVisibility, other.colVisibility);
+ if (part == ROW_COLFAM_COLQUAL_COLVIS)
+ return result;
+ result &= (timestamp == other.timestamp);
+ if (part == ROW_COLFAM_COLQUAL_COLVIS_TIME)
+ return result;
+ result &= (deleted == other.deleted);
+ if (part == ROW_COLFAM_COLQUAL_COLVIS_TIME_DEL)
Review Comment:
Good catch. I'll revert this to how it was.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]