pandeysambhi opened a new pull request, #11204:
URL: https://github.com/apache/gravitino/pull/11204
<!--
1. Title: [#<issue>] <type>(<scope>): <subject>
Examples:
- "[#123] feat(operator): Support xxx"
- "[#233] fix: Check null before access result in xxx"
- "[MINOR] refactor: Fix typo in variable name"
- "[MINOR] docs: Fix typo in README"
- "[#255] test: Fix flaky test NameOfTheTest"
Reference: https://www.conventionalcommits.org/en/v1.0.0/
2. If the PR is unfinished, please mark this PR as draft.
-->
### What changes were proposed in this pull request?
Implements read-only view discovery (listViews / loadView) for all JDBC
catalogs as a subtask of [#604](https://github.com/apache/gravitino/issues/604).
- Add ViewOperation interface and JdbcViewOperations abstract base class
using JDBC DatabaseMetaData to list and load view metadata
- Add MysqlViewOperations using SHOW CREATE VIEW (avoids the 64KB truncation
in information_schema)
- Add PostgreSqlViewOperations using pg_views for reliable definition
retrieval
- Add InformationSchemaJdbcViewOperations as a generic fallback for catalogs
with standard information_schema.views
- Add JdbcView model implementing the View API with full builder
- Wire ViewCatalog into JdbcCatalogOperations and JdbcCatalog; write
operations (createView, alterView, dropView) throw UnsupportedOperationException
- Add Dialects.MYSQL and Dialects.POSTGRESQL constants to the API
- Wire dialect-appropriate view operations into MySQL, PostgreSQL, Doris,
StarRocks, OceanBase, ClickHouse, and Hologres catalogs
### Why are the changes needed?
Gravitino currently has no way to discover views that exist natively in
underlying JDBC databases. This blocks use cases where users manage views
directly in the database and want to query or inspect them through Gravitino's
metadata layer.
Fix: #11000
### Does this PR introduce _any_ user-facing change?
Yes.
- JDBC catalogs (jdbc-mysql, jdbc-postgresql, jdbc-doris, jdbc-starrocks,
jdbc-oceanbase, jdbc-clickhouse, jdbc-hologres) now implement ViewCatalog.
Users can call catalog.asViewCatalog() and use listViews() and loadView()
against any of these catalogs for the first time.
- Calling createView, alterView, or dropView on a JDBC catalog throws
UnsupportedOperationException with a descriptive message, as JDBC catalogs
support read-only view discovery only.
### How was this patch tested?
Unit tests: TestJdbcViewOperations covers extractSelectBodyFromCreateView
and WITH CHECK OPTION stripping
Integration test: CatalogMysqlViewIT (Docker-tagged) tests listViews,
loadView, column introspection, SQL representation, NoSuchViewException, and
that createView throws UnsupportedOperationException against a live MySQL
container
--
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]