justinmclean opened a new issue, #8408:
URL: https://github.com/apache/gravitino/issues/8408

   ### What would you like to be improved?
   
   In 
core/src/test/java/org/apache/gravitino/storage/relational/mapper/provider/h2/TestGroupMetaH2Provider.java
 ensure empty arrays are represented as [] when no roles are associated with a 
group.
   
   Here a unit test to help:
   ```
     @Test
     public void testListExtendedGroupPOsByMetalakeIdWithoutRoles() throws 
Exception {
       try (Connection conn =
               DriverManager.getConnection("jdbc:h2:mem:test;MODE=MYSQL", "sa", 
"");
           Statement stmt = conn.createStatement()) {
         stmt.execute(
             "CREATE TABLE group_meta (group_id BIGINT, group_name 
VARCHAR(255), metalake_id BIGINT, "
                 + "audit_info VARCHAR(255), current_version BIGINT, 
last_version BIGINT, deleted_at BIGINT)");
         stmt.execute(
             "CREATE TABLE group_role_rel (group_id BIGINT, role_id BIGINT, 
deleted_at BIGINT)");
         stmt.execute(
             "CREATE TABLE role_meta (role_id BIGINT, role_name VARCHAR(255), 
deleted_at BIGINT)");
   
         stmt.execute(
             "INSERT INTO group_meta VALUES (1, 'g1', 1, 'audit', 0, 0, 0)");
   
         GroupMetaH2Provider provider = new GroupMetaH2Provider();
         String sql = 
provider.listExtendedGroupPOsByMetalakeId(1L).replace("#{metalakeId}", "1");
         try (ResultSet rs = stmt.executeQuery(sql)) {
           rs.next();
           assertEquals("[]", rs.getString("roleNames"));
           assertEquals("[]", rs.getString("roleIds"));
         }
       }
     }
   ```
   
   ### How should we improve?
   
   Using COALESCE may be one way of fixing the issue.


-- 
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]

Reply via email to