dengc367 opened a new pull request, #14341:
URL: https://github.com/apache/gravitino/pull/14341
### What changes were proposed in this pull request?
Add read-only view support to the StarRocks JDBC catalog.
`StarRocksCatalogOperations` now
implements `ViewCatalog`, backed by `StarRocksViewOperations`:
- `listViews` reads `information_schema.views`, so only logical views are
listed. StarRocks
reports async materialized views as `TABLE_TYPE = 'VIEW'` in
`information_schema.tables`,
but they have no `information_schema.views` row, so they are not views
here. That matches
what users see in StarRocks itself.
- `loadView` returns the view comment, output columns and the
`VIEW_DEFINITION` as a
`SQLRepresentation` in the `starrocks` dialect. Columns reuse the existing
table column
mapping, so a view column and the same table column report the same type.
- `StarRocksTableOperations#getTable` now applies the table type filter, so
loading a view
name through the table API raises `NoSuchTableException` instead of
failing later in
`SHOW CREATE TABLE`. That is what lets callers fall back from the table
API to the view
API.
Create, alter and drop keep the `ViewCatalog` defaults and stay unsupported.
### Why are the changes needed?
Fixes #14340
StarRocks exposes views next to tables, but the catalog only implemented
table operations.
Through Gravitino a view was therefore either invisible or surfaced as a
table that failed
on the first metadata call. The fallback from tables to views depends on
`NoSuchTableException`, which the table path never raised for a view name.
### Does this PR introduce _any_ user-facing change?
Yes, for StarRocks catalogs:
- `LIST VIEWS`, `LOAD VIEW` and the view REST endpoints now work, and the
web UI lists views.
- View columns and SQL definitions are available, so a view can be used as a
Semantic Model
source and authorized per view.
No configuration key is added or removed.
### How was this patch tested?
- New unit test class `TestStarRocksViewOperations`, 11 tests, run with
`./gradlew :catalogs:catalog-jdbc-starrocks:test --tests
"*TestStarRocksViewOperations"`.
It covers comment/column/definition loading, logical-view-only listing,
async
materialized views, blank and missing definitions, missing views,
parameter binding,
resource closing, the `ViewCatalog` factory wiring, and
`NoSuchTableException` for a view
name on the table path.
- `./gradlew :catalogs:catalog-jdbc-starrocks:spotlessCheck` passes.
- The change has been running in our production StarRocks deployment since
2026-10-09,
where it backs the semantic-model view sources.
--
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]