Skip to content

Commit

Permalink
HBASE-29004 Optimize unnecessary type castings in Scan and Get setter…
Browse files Browse the repository at this point in the history
… methods. (#6500)

Signed-off-by: Duo Zhang <zhangduo@apache.org>
Signed-off-by: Pankaj Kumar<pankajkumar@apache.org>
  • Loading branch information
chandrasekhar-188k authored Jan 18, 2025
1 parent d477bf1 commit 6f8db78
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 22 deletions.
33 changes: 22 additions & 11 deletions hbase-client/src/main/java/org/apache/hadoop/hbase/client/Get.java
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ public Get setTimestamp(long timestamp) {

@Override
public Get setColumnFamilyTimeRange(byte[] cf, long minStamp, long maxStamp) {
return (Get) super.setColumnFamilyTimeRange(cf, minStamp, maxStamp);
super.setColumnFamilyTimeRange(cf, minStamp, maxStamp);
return this;
}

/**
Expand Down Expand Up @@ -242,7 +243,8 @@ public Get readVersions(int versions) throws IOException {

@Override
public Get setLoadColumnFamiliesOnDemand(boolean value) {
return (Get) super.setLoadColumnFamiliesOnDemand(value);
super.setLoadColumnFamiliesOnDemand(value);
return this;
}

/**
Expand Down Expand Up @@ -476,46 +478,55 @@ public boolean equals(Object obj) {

@Override
public Get setAttribute(String name, byte[] value) {
return (Get) super.setAttribute(name, value);
super.setAttribute(name, value);
return this;
}

@Override
public Get setId(String id) {
return (Get) super.setId(id);
super.setId(id);
return this;
}

@Override
public Get setAuthorizations(Authorizations authorizations) {
return (Get) super.setAuthorizations(authorizations);
super.setAuthorizations(authorizations);
return this;
}

@Override
public Get setACL(Map<String, Permission> perms) {
return (Get) super.setACL(perms);
super.setACL(perms);
return this;
}

@Override
public Get setACL(String user, Permission perms) {
return (Get) super.setACL(user, perms);
super.setACL(user, perms);
return this;
}

@Override
public Get setConsistency(Consistency consistency) {
return (Get) super.setConsistency(consistency);
super.setConsistency(consistency);
return this;
}

@Override
public Get setReplicaId(int Id) {
return (Get) super.setReplicaId(Id);
super.setReplicaId(Id);
return this;
}

@Override
public Get setIsolationLevel(IsolationLevel level) {
return (Get) super.setIsolationLevel(level);
super.setIsolationLevel(level);
return this;
}

@Override
public Get setPriority(int priority) {
return (Get) super.setPriority(priority);
super.setPriority(priority);
return this;
}
}
33 changes: 22 additions & 11 deletions hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,8 @@ public Scan setTimestamp(long timestamp) {

@Override
public Scan setColumnFamilyTimeRange(byte[] cf, long minStamp, long maxStamp) {
return (Scan) super.setColumnFamilyTimeRange(cf, minStamp, maxStamp);
super.setColumnFamilyTimeRange(cf, minStamp, maxStamp);
return this;
}

/**
Expand Down Expand Up @@ -717,7 +718,8 @@ public boolean getAllowPartialResults() {

@Override
public Scan setLoadColumnFamiliesOnDemand(boolean value) {
return (Scan) super.setLoadColumnFamiliesOnDemand(value);
super.setLoadColumnFamiliesOnDemand(value);
return this;
}

/**
Expand Down Expand Up @@ -847,47 +849,56 @@ public boolean isRaw() {

@Override
public Scan setAttribute(String name, byte[] value) {
return (Scan) super.setAttribute(name, value);
super.setAttribute(name, value);
return this;
}

@Override
public Scan setId(String id) {
return (Scan) super.setId(id);
super.setId(id);
return this;
}

@Override
public Scan setAuthorizations(Authorizations authorizations) {
return (Scan) super.setAuthorizations(authorizations);
super.setAuthorizations(authorizations);
return this;
}

@Override
public Scan setACL(Map<String, Permission> perms) {
return (Scan) super.setACL(perms);
super.setACL(perms);
return this;
}

@Override
public Scan setACL(String user, Permission perms) {
return (Scan) super.setACL(user, perms);
super.setACL(user, perms);
return this;
}

@Override
public Scan setConsistency(Consistency consistency) {
return (Scan) super.setConsistency(consistency);
super.setConsistency(consistency);
return this;
}

@Override
public Scan setReplicaId(int Id) {
return (Scan) super.setReplicaId(Id);
super.setReplicaId(Id);
return this;
}

@Override
public Scan setIsolationLevel(IsolationLevel level) {
return (Scan) super.setIsolationLevel(level);
super.setIsolationLevel(level);
return this;
}

@Override
public Scan setPriority(int priority) {
return (Scan) super.setPriority(priority);
super.setPriority(priority);
return this;
}

/**
Expand Down

0 comments on commit 6f8db78

Please sign in to comment.