[Cherry-pick to branch-1.3] [#12501][#12500] feat(core): Support FUNCTION and VIEW metadata object policies (#12503) - #12904
Merged
Conversation
…t policies (#12503) ### What changes were proposed in this pull request? Add FUNCTION and VIEW to the supported metadata object types for policy association in PolicyManager, and add PolicyMetadataObjectRelMapper cleanup when functions and views are deleted. ### Why are the changes needed? Fixes #12501 Fixes #12500. Currently, FUNCTION and VIEW exist in MetadataObject.Type but are excluded from PolicyManager.SUPPORTED_METADATA_OBJECT_TYPES_FOR_POLICIES. As a result, policy association requests for functions and views are rejected with "Cannot associate policies for unsupported metadata object type FUNCTION/VIEW". Additionally, when a function or view is deleted, its policy relations are not cleaned up, leaving orphaned records. ### How was this patch tested? Existing tests cover the policy association, listing, retrieval, and removal flows. The changes follow the same pattern as existing supported types (FILESET, TOPIC, MODEL). ### Does this PR introduce any user-facing changes? Yes - users can now associate policies with FUNCTION and VIEW metadata objects via the REST API. --------- Co-authored-by: mchades <liminghuang@datastrato.com> Co-authored-by: Jerry Shao <jerryshao@datastrato.com> # Conflicts: # core/src/main/java/org/apache/gravitino/storage/relational/mapper/provider/base/PolicyMetadataObjectRelBaseSQLProvider.java # core/src/main/java/org/apache/gravitino/storage/relational/mapper/provider/postgresql/PolicyMetadataObjectRelPostgreSQLProvider.java
Contributor
|
@mchades please fix the conflicts. |
Contributor
|
fixed |
Author
Code Coverage Report
Files
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cherry-pick Information:
branch-1.3Resolution:
branch-1.3deletion timestamp implementation and added only the mapper imports required by the VIEW/FUNCTION cleanup SQL.DatabaseTimeSQLdependency.Validation:
./gradlew :core:spotlessApply :clients:client-java:spotlessApply :docs:spotlessApply --no-daemon./gradlew :core:test --tests org.apache.gravitino.policy.TestPolicyManager -PskipITs -PskipDockerTests=true --no-daemon./gradlew :docs:build --no-daemon./gradlew :clients:client-java:test --tests org.apache.gravitino.client.integration.test.PolicyIT -PskipDockerTests=false -PtestMode=embedded --no-daemon(14 tests, 0 failures, 0 errors)git diff --check