rubberliu opened a new issue, #7772:
URL: https://github.com/apache/kyuubi/issues/7772

   ### Describe the feature
   
   Support listing persistent views from non-session Apache Paimon catalogs 
through HiveServer2 `GetTables` / JDBC `DatabaseMetaData.getTables`, including 
`TABLE_TYPE = VIEW` and view comments.
   
   ### Motivation and source findings
   
   I inspected Apache Paimon `release-2.0.0` and Apache Kyuubi master at 
`4cdc3465bd9a61cdfda596d3e9991a4faaa47485`.
   
   Paimon exposes views through its own 
`org.apache.paimon.spark.catalog.SupportView` interface, rather than Spark's 
`org.apache.spark.sql.connector.catalog.ViewCatalog`:
   
   - `listViews(String[])` returns `List<String>`.
   - `loadView(Identifier)` returns `org.apache.paimon.view.View`.
   - View comments are available through `comment(): Optional<String>`.
   - `SparkCatalog.listTables` does not merge the results of `listViews`.
   
   Sources:
   - [Paimon SparkCatalog implements 
SupportView](https://github.com/apache/paimon/blob/release-2.0.0/paimon-spark/paimon-spark-common/src/main/java/org/apache/paimon/spark/SparkCatalog.java#L115-L120)
   - [Paimon 
SupportView](https://github.com/apache/paimon/blob/release-2.0.0/paimon-spark/paimon-spark-common/src/main/java/org/apache/paimon/spark/catalog/SupportView.java#L38-L53)
   - [Paimon table 
listing](https://github.com/apache/paimon/blob/release-2.0.0/paimon-spark/paimon-spark-common/src/main/java/org/apache/paimon/spark/SparkCatalog.java#L289-L299)
   - [Paimon view 
comments](https://github.com/apache/paimon/blob/release-2.0.0/paimon-api/src/main/java/org/apache/paimon/view/View.java#L49-L50)
   
   Meanwhile, [Kyuubi's non-session V2 catalog 
path](https://github.com/apache/kyuubi/blob/4cdc3465bd9a61cdfda596d3e9991a4faaa47485/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/util/SparkCatalogUtils.scala#L234-L247)
 only calls `listTables` and labels the resulting rows as `TABLE`. 
Consequently, this path does not enumerate Paimon's persistent views, even when 
the client requests `VIEW` alongside `TABLE`.
   
   This leaves JDBC/BI clients unable to discover those views through the 
standard metadata API, even when the backing Paimon catalog supports them.
   
   **Verification scope:** These findings are based on source inspection, not 
an end-to-end reproduction using unmodified upstream distributions.
   
   ### Proposed solution and questions
   
   One possible approach is an optional, reflection-based adapter for Paimon 
`SupportView`, without introducing a compile-time Paimon dependency:
   
   - Enumerate views separately.
   - Combine view names with their namespace to construct identifiers.
   - Apply the requested table types and name pattern.
   - Return view comments, while respecting `ignoreTableProperties`.
   
   This would complement, rather than replace, support for catalogs 
implementing Spark's `ViewCatalog`.
   
   Would maintainers consider this approach appropriate, or prefer a different 
integration mechanism? What version coverage and integration tests would be 
expected for a contribution?
   
   ### Related work
   
   I searched the existing issues and pull requests but did not find one 
specifically covering Paimon `SupportView` in `GetTables`.
   
   PR #7718 explicitly documents that non-session V2 catalogs only report 
tables and leaves their view support out of scope. PR #7064 also discusses 
catalog metadata handling, but neither appears to address Paimon `SupportView` 
directly.
   


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to