yunchipang commented on code in PR #7476:
URL: https://github.com/apache/gravitino/pull/7476#discussion_r2213974085
##########
server/src/main/java/org/apache/gravitino/server/web/rest/TagOperations.java:
##########
@@ -248,6 +248,50 @@ public Response listMetadataObjectsForTag(
}
}
+ private String[] parseTagsParameter(String tagsParam) {
+ if (tagsParam == null || tagsParam.trim().isEmpty()) {
+ throw new IllegalArgumentException("Tags parameter cannot be null or
empty");
+ }
+
+ return Arrays.stream(tagsParam.split(","))
+ .map(String::trim)
+ .filter(tag -> !tag.isEmpty())
+ .toArray(String[]::new);
+ }
+
+ @GET
+ @Path("objects")
+ @Produces("application/vnd.gravitino.v1+json")
+ @Timed(name = "list-objects-for-tags." + MetricNames.HTTP_PROCESS_DURATION,
absolute = true)
+ @ResponseMetered(name = "list-objects-for-tags", absolute = true)
+ public Response listMetadataObjectsForTags(
+ @PathParam("metalake") String metalake, @QueryParam("tags") String
tagsParam) {
+ LOG.info("Received list objects for tags: {} under metalake: {}",
tagsParam, metalake);
+
+ try {
+ return Utils.doAs(
+ httpRequest,
+ () -> {
+ String[] tagNames = parseTagsParameter(tagsParam);
+
+ MetadataObject[] objects =
tagDispatcher.listMetadataObjectsForTags(metalake, tagNames);
+ objects = objects == null ? new MetadataObject[0] : objects;
Review Comment:
oops. I was following what `listMetadataObjectsForTag` did:
https://github.com/apache/gravitino/blob/58e0a2f331149ee5aefff844cd44145443423cd1/server/src/main/java/org/apache/gravitino/server/web/rest/TagOperations.java#L224-L233
after looking thru the code, I believe
`tagDispatcher.listMetadataObjectsForTag()` never returns null, I am removing
the null check for `objects` for both `listMetadataObjectsForTag` and
`listMetadataObjectsForTags` then. thank you for pointing this out!
--
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]