sunchao commented on a change in pull request #2421:
URL: https://github.com/apache/hive/pull/2421#discussion_r702364444
##########
File path:
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandler.java
##########
@@ -5156,14 +5155,40 @@ public boolean drop_partition(final String db_name,
final String tbl_name,
null);
}
- private static class PathAndPartValSize {
- PathAndPartValSize(Path path, int partValSize) {
- this.path = path;
- this.partValSize = partValSize;
+ /** Stores a path and its size. */
+ private static class PathAndDepth implements Comparable<PathAndDepth> {
+
+ final Path path;
+ final int depth;
+
+ public PathAndDepth(Path path, int depth) {
+ this.path = path;
+ this.depth = depth;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(path.hashCode(), depth);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o == this) {
+ return true;
+ }
+ if (!(o instanceof PathAndDepth)) {
+ return false;
+ }
+ PathAndDepth p = (PathAndDepth) o;
+ return path.equals(p.path) && depth == p.depth;
Review comment:
we can just use auto-generated `equals` method and should handle null
here too:
```java
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PathAndDepth that = (PathAndDepth) o;
return depth == that.depth && Objects.equals(path, that.path);
}
```
##########
File path:
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandler.java
##########
@@ -5156,14 +5155,40 @@ public boolean drop_partition(final String db_name,
final String tbl_name,
null);
}
- private static class PathAndPartValSize {
- PathAndPartValSize(Path path, int partValSize) {
- this.path = path;
- this.partValSize = partValSize;
+ /** Stores a path and its size. */
+ private static class PathAndDepth implements Comparable<PathAndDepth> {
+
Review comment:
nit: extra empty line
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]