Skip to content

[Cherry-pick to branch-1.3] [#12501][#12500] feat(core): Support FUNCTION and VIEW metadata object policies (#12503) - #12904

Merged
mchades merged 2 commits into
branch-1.3from
cherry-pick-3afc9f16-to-branch-1.3
Sep 4, 2026
Merged

[Cherry-pick to branch-1.3] [#12501][#12500] feat(core): Support FUNCTION and VIEW metadata object policies (#12503)#12904
mchades merged 2 commits into
branch-1.3from
cherry-pick-3afc9f16-to-branch-1.3

Conversation

@github-actions

@github-actions github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown

Cherry-pick Information:

  • Original commit: 3afc9f1
  • Target branch: branch-1.3
  • Status: ✅ Conflicts resolved manually

Resolution:

  • Kept the existing branch-1.3 deletion timestamp implementation and added only the mapper imports required by the VIEW/FUNCTION cleanup SQL.
  • Preserved the original FUNCTION/VIEW policy association, direct cleanup, and catalog/schema cascade cleanup without introducing the main-only DatabaseTimeSQL dependency.

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)
  • Conflict-marker scan and git diff --check

…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
@github-actions github-actions Bot added cherry-pick Automatically opened cherry-pick PR cherry-pick-conflict Cherry-pick has conflicts; needs human resolution before merge labels Sep 4, 2026
@github-actions
github-actions Bot requested a review from jerryshao September 4, 2026 02:35
@jerryshao

Copy link
Copy Markdown
Contributor

@mchades please fix the conflicts.

@mchades mchades changed the title [DO NOT MERGE] [Cherry-pick to branch-1.3] [#12501][#12500] feat(core): Support FUNCTION and VIEW metadata object policies (#12503) [Cherry-pick to branch-1.3] [#12501][#12500] feat(core): Support FUNCTION and VIEW metadata object policies (#12503) Sep 4, 2026
@mchades mchades removed the cherry-pick-conflict Cherry-pick has conflicts; needs human resolution before merge label Sep 4, 2026
@mchades

mchades commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

fixed

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Author

Code Coverage Report

Overall Project 68.66% +0.09% 🟢
Files changed 82.06% 🟢

Module Coverage
aliyun 19.74% 🔴
api 47.62% 🟢
authorization-common 85.96% 🟢
aws 53.54% 🟢
azure 32.1% 🔴
catalog-common 10.4% 🔴
catalog-fileset 80.51% 🟢
catalog-glue 69.24% 🟢
catalog-hive 79.42% 🟢
catalog-jdbc-clickhouse 84.7% 🟢
catalog-jdbc-common 45.47% 🟢
catalog-jdbc-doris 82.61% 🟢
catalog-jdbc-hologres 54.03% 🟢
catalog-jdbc-mysql 79.33% 🟢
catalog-jdbc-oceanbase 78.6% 🟢
catalog-jdbc-postgresql 83.39% 🟢
catalog-jdbc-starrocks 79.16% 🟢
catalog-kafka 77.27% 🟢
catalog-lakehouse-generic 59.35% 🟢
catalog-lakehouse-hudi 79.1% 🟢
catalog-lakehouse-iceberg 85.86% 🟢
catalog-lakehouse-paimon 82.17% 🟢
catalog-model 77.99% 🟢
cli 44.51% 🟢
client-java 78.31% 🟢
common 50.74% 🟢
core 82.97% +0.07% 🟢
filesystem-hadoop3 77.3% 🟢
flink 0.0% 🔴
flink-common 49.22% 🟢
flink-runtime 0.0% 🔴
gcp 32.2% 🔴
hadoop-common 15.43% 🔴
hive-metastore-common 53.77% 🟢
iceberg-aliyun-bundle 0.0% 🔴
iceberg-common 58.18% 🟢
iceberg-rest-server 73.95% 🟢
idp-basic 86.02% 🟢
integration-test-common 0.0% 🔴
jobs 66.17% 🟢
lance-common 24.42% 🔴
lance-rest-server 60.13% 🟢
lineage 53.02% 🟢
optimizer 82.95% 🟢
optimizer-api 21.95% 🔴
server 88.58% -1.04% 🟢
server-common 76.28% 🟢
spark 28.57% 🔴
spark-common 41.66% 🟢
trino-connector 51.18% 🟢
Files
Module File Coverage
core FunctionMetaService.java 100.0% 🟢
ViewMetaService.java 100.0% 🟢
PolicyManager.java 81.09% 🟢
PolicyMetadataObjectRelBaseSQLProvider.java 76.92% 🟢
PolicyMetadataObjectRelPostgreSQLProvider.java 70.0% 🟢
server VersioningFilter.java 97.56% 🟢
GravitinoServer.java 61.36% 🟢

@mchades
mchades merged commit 7f59be2 into branch-1.3 Sep 4, 2026
35 checks passed
@mchades
mchades deleted the cherry-pick-3afc9f16-to-branch-1.3 branch September 4, 2026 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cherry-pick Automatically opened cherry-pick PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants