mxnzx opened a new pull request, #8131:
URL: https://github.com/apache/gravitino/pull/8131

   
   ### What changes were proposed in this pull request?
   
   - **TagDTO**: include `inherited` in `equals()` and `hashCode()`.
   - **MetadataObjectTagOperations**: when listing tags (`details=true`), 
**de-duplicate by tag name** and **prefer direct over inherited**; names-only 
path also returns unique names.
   - **Tests**: add a unit test to ensure `inherited` affects equality; 
existing REST test (`TestMetadataObjectTagOperations`) now passes with the 
dedup logic.
   
   ### Why are the changes needed?
   
   (AS-IS)
   - `TagDTO.equals/hashCode` ignored `inherited`, so two tags with the same 
name but different inheritance were considered equal.
   - The list API could return duplicate tag names (one inherited, one direct), 
and `inherited` on the returned tag might not reflect the stronger (direct) 
association.
   
   (TO-BE)
   - `TagDTO` equality/hash now considers `inherited` so comparisons are 
accurate.
   - Listing tags de-duplicates by name and **keeps the direct association when 
both direct and inherited exist**. This keeps the expected count stable and the 
`inherited` flag correct.
   
   Fix: #8084 
   
   ### Does this PR introduce _any_ user-facing change?
   
   - API shape unchanged.
   - Listing tags (`/metalakes/{metalake}/objects/.../tags`) now:
     - Does not return duplicate names when both direct and inherited exist.
     - For duplicate names, the returned entry is the **direct** one 
(`inherited=false`).
   - This aligns with existing test expectations; functional behavior is 
clarified and made consistent.
   
   
   ### How was this patch tested?
   
   - Local runs:
     - `./gradlew spotlessApply`
     - `./gradlew :server:test --tests 
"*TestMetadataObjectTagOperations.testListTagsForObject*"`
     - `./gradlew :common:test --tests 
"org.apache.gravitino.dto.tag.TestTagDTO"`
     - `./gradlew test -PskipITs`


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