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

   ### What changes were proposed in this pull request?
   
   Tag/policy inheritance for a metadata object is computed in the REST layer
   (`MetadataObjectTagOperations` / `MetadataObjectPolicyOperations`), which 
walks
   ancestors via `MetadataObjects.parent()` and marks each with 
`inherited=true`.
   
   This PR adds `MetadataObjectUtil.getParentMetadataObjects()`, a shared 
helper that
   returns the ancestor chain and **expands multi-level (hierarchical) schema
   ancestors** using the configured `gravitino.schema.separator`. All four
   parent-walks (list + get, for tags and policies) now use it. Docs for 
tag/policy
   inheritance are updated to describe the hierarchical-schema semantics.
   
   ### Why are the changes needed?
   
   For a hierarchical schema such as `a:b:c`, the parent walk jumped straight 
from
   the schema to the catalog, **skipping the intermediate parent schemas `a:b` 
and
   `a`**. As a result, tags/policies assigned to a parent schema were not 
inherited
   by its child schemas or the tables/views within them, which does not match 
users'
   expectations for hierarchical metadata management.
   
   Fix: #11639
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. Listing tags/policies of an object under a multi-level schema now also 
returns
   the tags/policies of the intermediate parent schemas (marked 
`inherited=true`).
   No API or property-key changes.
   
   ### How was this patch tested?
   
   - Unit tests `TestMetadataObjectUtil` for the new helper (flat schema, 
hierarchical
     schema, column-under-hierarchical cases).
   - `TestMetadataObjectTagOperations` / `TestMetadataObjectPolicyOperations`: 
new tests
     asserting a table under `hcat.a:b:c.tbl` inherits from `a:b:c`, `a:b`, 
`a`, and the catalog.
   - New integration test `HierarchicalSchemaTagPolicyIT` (embedded server + 
Iceberg/H2
     catalog with separator `:`) verifying end-to-end tag and policy 
inheritance through
     the hierarchical schema chain. Both IT tests pass.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


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