@Override
  public int execute() throws HiveException, IOException {
    HiveAuthorizer authorizer = PrivilegeUtils.getSessionAuthorizer(context.getConf());
    List<String> allRoles = authorizer.getAllRoles();
    PrivilegeUtils.writeListToFileAfterSort(allRoles, desc.getResFile(), context);
    return 0;
  }
Operation process of showing the roles.
ql/src/java/org/apache/hadoop/hive/ql/ddl/privilege/role/show/ShowRolesOperation.java