Code review comment: I think we can remove the DEFAULT_CLUSTER also. The feature is useless but only has compatibility.

Code before review:
public TGetDBPrivsResult getDBPrivs(TGetDBPrivsParams params) throws TException {
LOG.debug("get database privileges request: {}", params);
TGetDBPrivsResult result = new TGetDBPrivsResult();
List<TDBPrivDesc> tDBPrivs = Lists.newArrayList();
result.setDb_privs(tDBPrivs);
UserIdentity currentUser = UserIdentity.fromThrift(params.current_user_ident);
List<DbPrivEntry> dbPrivEntries = GlobalStateMgr.getCurrentState().getAuth().getDBPrivEntries(currentUser);
for (DbPrivEntry entry : dbPrivEntries) {
PrivBitSet savedPrivs = entry.getPrivSet();
String clusterPrefix = SystemInfoService.DEFAULT_CLUSTER + ClusterNamespace.CLUSTER_DELIMITER;
String userIdentStr = currentUser.toString().replace(clusterPrefix, "");
String dbName = entry.getOrigDb();
boolean isGrantable = savedPrivs.satisfy(PrivPredicate.GRANT);
List<TDBPrivDesc> tPrivs = savedPrivs.toPrivilegeList().stream().map(
priv -> {
TDBPrivDesc privDesc = new TDBPrivDesc();
privDesc.setDb_name(dbName);
privDesc.setIs_grantable(isGrantable);
privDesc.setUser_ident_str(userIdentStr);
privDesc.setPriv(priv.getUpperNameForMysql());
return privDesc;
}
).collect(Collectors.toList());
if (savedPrivs.satisfy(PrivPredicate.LOAD)) {
tPrivs.addAll(Lists.newArrayList("INSERT", "UPDATE", "DELETE").stream().map(priv -> {
TDBPrivDesc privDesc = new TDBPrivDesc();
privDesc.setDb_name(dbName);
privDesc.setIs_grantable(isGrantable);
privDesc.setUser_ident_str(userIdentStr);
privDesc.setPriv(priv);
return privDesc;
}).collect(Collectors.toList()));
}
tDBPrivs.addAll(tPrivs);
}
return result;
}

Line under review: String clusterPrefix = SystemInfoService.DEFAULT_CLUSTER + ClusterNamespace.CLUSTER_DELIMITER;

Code after addressing the review:
public TGetDBPrivsResult getDBPrivs(TGetDBPrivsParams params) throws TException {
LOG.debug("get database privileges request: {}", params);
TGetDBPrivsResult result = new TGetDBPrivsResult();
List<TDBPrivDesc> tDBPrivs = Lists.newArrayList();
result.setDb_privs(tDBPrivs);
UserIdentity currentUser = UserIdentity.fromThrift(params.current_user_ident);
List<DbPrivEntry> dbPrivEntries = GlobalStateMgr.getCurrentState().getAuth().getDBPrivEntries(currentUser);
for (DbPrivEntry entry : dbPrivEntries) {
PrivBitSet savedPrivs = entry.getPrivSet();
String clusterPrefix = SystemInfoService.DEFAULT_CLUSTER + ClusterNamespace.CLUSTER_DELIMITER;
String userIdentStr = currentUser.toString().replace(clusterPrefix, "");
String dbName = entry.getOrigDb();
boolean isGrantable = savedPrivs.satisfy(PrivPredicate.GRANT);
List<TDBPrivDesc> tPrivs = savedPrivs.toPrivilegeList().stream().map(
priv -> {
TDBPrivDesc privDesc = new TDBPrivDesc();
privDesc.setDb_name(dbName);
privDesc.setIs_grantable(isGrantable);
privDesc.setUser_ident_str(userIdentStr);
privDesc.setPriv(priv.getUpperNameForMysql());
return privDesc;
}
).collect(Collectors.toList());
if (savedPrivs.satisfy(PrivPredicate.LOAD)) {
tPrivs.addAll(Lists.newArrayList("INSERT", "UPDATE", "DELETE").stream().map(priv -> {
TDBPrivDesc privDesc = new TDBPrivDesc();
privDesc.setDb_name(dbName);
privDesc.setIs_grantable(isGrantable);
privDesc.setUser_ident_str(userIdentStr);
privDesc.setPriv(priv);
return privDesc;
}).collect(Collectors.toList()));
}
tDBPrivs.addAll(tPrivs);
}
return result;
}