Skip to content

[Cherry-pick to branch-1.3] [#11844] feat(tag): Support tags for views and functions - #12714

Merged
jerryshao merged 7 commits into
apache:branch-1.3from
jerryshao:cherry-pick-view-function-tags-1.3
Aug 28, 2026
Merged

[Cherry-pick to branch-1.3] [#11844] feat(tag): Support tags for views and functions#12714
jerryshao merged 7 commits into
apache:branch-1.3from
jerryshao:cherry-pick-view-function-tags-1.3

Conversation

@jerryshao

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

This PR backports view/function tag support from main to branch-1.3:

The Python client had no View API at all on branch-1.3 (it was added on main after the
branch was cut), so 4 prerequisite commits are included to bring it to parity before applying
the tag-support patch:

One trivial doc conflict in docs/manage-tags-in-gravitino.md was resolved manually: the intro
text that #11903 added (listing taggable object types) is redundant with branch-1.3's existing,
already-restructured docs/tags.md, which already lists VIEW/FUNCTION as taggable.

Why are the changes needed?

Feature parity: branch-1.3 should support tagging views and functions consistently across
server, Java client, and Python client, matching main.

Fix: #11844
Related: #11902, #12181

Does this PR introduce any user-facing change?

Yes, same as the source PRs:

  • REST/OpenAPI: VIEW and FUNCTION are now valid metadata object types for tag association.
  • Java client: view.supportsTags() / function.supportsTags() are available.
  • Python client: view.supports_tags() / function.supports_tags(); the Python client also
    gains full View CRUD (list/load/create/alter/drop) it previously lacked on branch-1.3.

How was this patch tested?

  • ./gradlew :api:compileJava :core:compileJava :clients:client-java:compileJava :clients:client-java:compileTestJava -q — passed.
  • ./gradlew :clients:client-java:test --tests "*TestSupportTags*" --tests "*TestFunctionCatalog*" --tests "*TagIT*" -PskipITs -q — passed.
  • ./gradlew :core:test --tests "org.apache.gravitino.tag.TestTagManager" -PskipITs -q — passed in isolation.
  • Python client: python -m pytest tests/unittests -k "view or function or tag" -q — 190 passed.

kevinw66 and others added 7 commits August 28, 2026 16:34
…e#11897)

### What changes were proposed in this pull request?

This PR adds tag support for VIEW and FUNCTION metadata objects.

The changes include:
- Allowing VIEW and FUNCTION in `TagManager` supported metadata object
types.
- Updating OpenAPI definitions for metadata object tag operations.
- Cleaning up function tag relations when functions are dropped.
- Cleaning up view/function tag relations during catalog and schema
cascade deletion, including PostgreSQL-specific SQL providers.
- Adding unit tests for tag association and cascade cleanup behavior.

### Why are the changes needed?

Views and functions are first-class metadata objects in Gravitino, but
they were excluded from tag association support. Users could not
organize, classify, or discover views and functions through tags like
other metadata objects.

Fix: apache#11844

### Does this PR introduce _any_ user-facing change?

Yes.

Users can now associate, list, get, and remove tags for VIEW and
FUNCTION metadata objects through the existing metadata object tag REST
APIs.

### How was this patch tested?

Added unit tests covering:
- TagManager support for VIEW and FUNCTION.
- REST metadata object tag operations for VIEW and FUNCTION.
- Tag relation cleanup when views/functions are dropped.
- Catalog/schema cascade cleanup for view/function tag relations.
- PostgreSQL tag relation cascade SQL provider coverage.

Ran:

```bash
./gradlew :core:test --tests org.apache.gravitino.storage.relational.mapper.provider.postgresql.TestTagMetadataObjectRelPostgreSQLProvider --tests org.apache.gravitino.storage.relational.service.TestSchemaMetaService --tests org.apache.gravitino.storage.relational.service.TestCatalogMetaService
```

(cherry picked from commit b464820)
apache#11903)

This PR adds Java client support for tag operations on views and
functions.

Changes include:

- Add default `supportsTags()` methods to the `View` and `Function` API
interfaces.
- Add `GenericView` and `GenericFunction` client wrappers backed by
`MetadataObjectTagOperations`.
- Return tag-capable wrappers from Java client view and function
operations.
- Add Java client tests for view/function tag support.

metadata objects. The Java client should expose the same capability so
users can manage tags for views and functions through the typed client
API, consistent with other tag-capable metadata objects.

Fix: apache#11902
Related: apache#11844

Yes.

Java client users can now call `supportsTags()` on `View` and `Function`
objects returned by the client, for example:

```java
view.supportsTags().associateTags(...);
function.supportsTags().listTags();
```

- `./gradlew :clients:client-java:test -PskipITs`

---------

Co-authored-by: Jerry Shao <jerryshao@datastrato.com>
(cherry picked from commit e71af9c)
…12040)

### What changes were proposed in this pull request?

This PR adds the public Python API definitions required for view
support.

The changes include:

- Add `View`, `ViewCatalog`, and `ViewChange`.
- Add `Representation`, `SQLRepresentation`, and predefined SQL
dialects.
- Add `Catalog.as_view_catalog()`.
- Add view-specific exception types.
- Add unit tests for view representations and changes.

### Why are the changes needed?

The Python client currently lacks the public API contracts required to
represent and manage views.

Fix: apache#12039

### Does this PR introduce _any_ user-facing change?

Yes. It adds public Python API definitions for views.

### How was this patch tested?

Added unit tests for `View`, `ViewChange`, and `SQLRepresentation`. The
formatting, lint, and unit test checks passed.

(cherry picked from commit c10925a)
… models (apache#12090)

### What changes were proposed in this pull request?

- Add `GenericView` as the client-side implementation of `View`.
- Add DTOs for views and SQL representations.
- Add polymorphic JSON serialization for view representations.
- Extend `DTOConverters` with representation conversions.
- Add unit tests for the new models, serialization, and conversions.

### Why are the changes needed?

The Python client needs concrete view models and serialization support
before view catalog operations can consume and return view metadata.

Fix: apache#12089

### Does this PR introduce _any_ user-facing change?

No. This PR adds the supporting client-side models. View catalog
operations will be added separately.

### How was this patch tested?

Added unit tests covering `GenericView`, view and representation DTOs,
representation serialization, and DTO conversions. Python client
formatting, lint, and unit tests pass.

(cherry picked from commit 648fdd7)
…tions (apache#12117)

### What changes were proposed in this pull request?

- Extend `RelationalCatalog` with `ViewCatalog`.
- Add `as_view_catalog`, `create_view`, and `drop_view`.
- Add request and response DTOs for view creation.
- Add view-specific REST error handling.
- Generalize the entity namespace helper for table and view operations.
- Add corresponding unit and integration tests.

### Why are the changes needed?

The Python client currently lacks support for view create/drop
operations. These changes allow users to create and drop views through
the Python client.

Fix: apache#12116

### Does this PR introduce _any_ user-facing change?

Yes. Python client users can now create and drop views through
`RelationalCatalog.as_view_catalog()`.

### How was this patch tested?

Added unit tests for request and response validation, REST error
handling, and view create/drop operations.

Added integration tests covering view creation, duplicate creation, view
deletion, and deletion of nonexistent views.

(cherry picked from commit 941f030)
…tions (apache#12159)

### What changes were proposed in this pull request?

- Add view list, load, existence check, and alter operations to
`RelationalCatalog`.
- Add request DTOs for view updates.
- Support rename, set/remove property, and replace view changes.
- Add corresponding unit and integration tests.

### Why are the changes needed?

The Python client currently supports view create/drop operations but
lacks view query/alter operations. These changes complete the basic view
management workflow through the Python client.

Fix: apache#12158

### Does this PR introduce _any_ user-facing change?

Yes. Python client users can now list, load, check, and alter views
through `RelationalCatalog.as_view_catalog()`.

### How was this patch tested?

Added unit tests for view query operations, update request conversion,
serialization, validation, and error handling.

Added integration tests covering view listing, loading, existence
checks, property updates, and related error cases.

(cherry picked from commit 2214a29)
…ons (apache#12182)

### What changes were proposed in this pull request?

This PR adds Python client support for tag operations on views and
functions.

Changes include:

- Add default `supports_tags()` methods to the `View` and `Function` API
classes.
- Extend `GenericView` and `GenericFunction` with tag operations backed
by `MetadataObjectTagOperations`.
- Return tag-capable wrappers from Python client view and function
operations.
- Add Python client unit and integration tests for view/function tag
support.

### Why are the changes needed?

apache#11844 enables server-side tag association for `VIEW` and `FUNCTION`
metadata objects. The Python client should expose the same capability so
users can manage tags for views and functions through the typed client
API, consistent with other tag-capable metadata objects.

Fix: apache#12181
Related: apache#11844

### Does this PR introduce _any_ user-facing change?

Yes.

Python client users can now call `supports_tags()` on `View` and
`Function` objects returned by the client, for example:

```python
view.supports_tags().associate_tags(...)
function.supports_tags().list_tags()
```

### How was this patch tested?

- `./gradlew :clients:client-python:black :clients:client-python:pylint
:clients:client-python:unitTests`
- `./gradlew :clients:client-python:integrationTest`

(cherry picked from commit a7d221c)
@jerryshao

Copy link
Copy Markdown
Contributor Author

NOTE. I will use rebase and merge.

@github-actions

Copy link
Copy Markdown

Code Coverage Report

Overall Project 67.77% +0.31% 🟢
Files changed 88.5% 🟢

Module Coverage
aliyun 1.72% 🔴
api 47.7% +0.08% 🟢
authorization-common 85.96% 🟢
aws 42.04% 🟢
azure 2.47% 🔴
catalog-common 10.4% 🔴
catalog-fileset 80.23% 🟢
catalog-glue 68.95% 🟢
catalog-hive 79.42% 🟢
catalog-jdbc-clickhouse 81.78% 🟢
catalog-jdbc-common 45.48% 🟢
catalog-jdbc-doris 82.36% 🟢
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.01% 🟢
catalog-lakehouse-generic 59.18% 🟢
catalog-lakehouse-hudi 79.1% 🟢
catalog-lakehouse-iceberg 85.94% 🟢
catalog-lakehouse-paimon 82.14% 🟢
catalog-model 77.72% 🟢
cli 44.51% 🟢
client-java 78.16% +1.42% 🟢
common 50.75% 🟢
core 82.92% +0.06% 🟢
filesystem-hadoop3 77.3% 🟢
flink 0.0% 🔴
flink-common 47.12% 🟢
flink-runtime 0.0% 🔴
gcp 14.12% 🔴
hadoop-common 10.88% 🔴
hive-metastore-common 53.77% 🟢
iceberg-aliyun-bundle 0.0% 🔴
iceberg-common 58.15% 🟢
iceberg-rest-server 73.9% 🟢
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 86.46% 🟢
server-common 76.03% +3.45% 🟢
spark 28.57% 🔴
spark-common 41.66% 🟢
trino-connector 40.97% 🟢
Files
Module File Coverage
api View.java 78.57% 🟢
Function.java 0.0% 🔴
client-java FunctionCatalogOperations.java 99.0% 🟢
RelationalCatalog.java 93.06% 🟢
GenericFunction.java 67.86% 🟢
GenericView.java 65.52% 🟢
core TagMetadataObjectRelBaseSQLProvider.java 100.0% 🟢
TagMetadataObjectRelPostgreSQLProvider.java 100.0% 🟢
FunctionMetaService.java 100.0% 🟢
TagManager.java 83.68% 🟢
server-common JcasbinAuthorizer.java 87.68% 🟢

@jerryshao
jerryshao merged commit 50261f1 into apache:branch-1.3 Aug 28, 2026
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants