mchades commented on code in PR #11882:
URL: https://github.com/apache/gravitino/pull/11882#discussion_r3733241423
##########
core/src/main/java/org/apache/gravitino/storage/relational/mapper/provider/h2/UserMetaH2Provider.java:
##########
@@ -53,4 +54,44 @@ public String
listExtendedUserPOsByMetalakeId(@Param("metalakeId") Long metalake
+ " ut.metalake_id = #{metalakeId}"
+ " GROUP BY ut.user_id";
}
+
+ @Override
+ public String listExtendedUserPOsByMetalakeNamePaginated(
+ @Param("metalakeName") String metalakeName,
+ @Param("offset") int offset,
+ @Param("limit") int limit) {
+ return "SELECT ut.user_id as userId, ut.user_name as userName,"
+ + " ut.metalake_id as metalakeId,"
+ + " ut.external_id as externalId, ut.enabled as enabled,"
+ + " ut.audit_info as auditInfo,"
+ + " ut.current_version as currentVersion, ut.last_version as
lastVersion,"
+ + " ut.deleted_at as deletedAt,"
+ + " '[' || GROUP_CONCAT('\"' || rot.role_name || '\"') || ']' as
roleNames,"
Review Comment:
Could we avoid building the JSON array by concatenating raw role names here?
Role names are only checked for non-empty values, so a valid name such as
`role"quoted` produces invalid JSON (`["role"quoted"]`), and
`POConverters.fromExtendedUserPO` then fails to deserialize the page. The group
pagination query has the same issue. Please use a JSON-safe aggregation or
escaping strategy and add an H2 regression test covering quotes and backslashes
in role names.
--
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]