bharatviswa504 commented on a change in pull request #1555: HDDS-1984. Fix listBucket API. URL: https://github.com/apache/hadoop/pull/1555#discussion_r332589314
########## File path: hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/utils/db/cache/CacheKey.java ########## @@ -53,4 +53,18 @@ public boolean equals(Object o) { public int hashCode() { return Objects.hash(key); } + + @Override + public int compareTo(Object o) { + if(Objects.equals(key, ((CacheKey<?>)o).key)) { + return 0; + } else { + if (key instanceof String) { + return ((String) key).compareTo((String) ((CacheKey<?>)o).key); + } else { + // If not type string, convert to string and compare. + return key.toString().compareTo((((CacheKey<?>) o).key).toString()); Review comment: Ya, you are right, my initial approach was that. But as this Table interface is extended by RDBTable which has byte[] as the parameter, that cannot be done. And also, for now, this is used for Bucket and VolumeTable we should be good. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-issues-h...@hadoop.apache.org