@Override
    public List<String> getGroupNames() {
      List<String> groups = new ArrayList<String>();
      if (getUserName().equals("user1")) {
        groups.add("group_a");
      } else if (getUserName().equals("user2")) {
        groups.add("group_a");
        groups.add("group_b");
      }
      return groups;
    }
Test restricted information schema with privilege synchronization
itests/hive-unit/src/test/java/org/apache/hive/service/server/InformationSchemaWithPrivilegeTestBase.java