LuciferYang opened a new issue, #14293: URL: https://github.com/apache/gravitino/issues/14293
### Version main branch ### Describe what's wrong When Spark reads a Hive view through the Gravitino Spark connector, `SparkHiveView` runs the view SQL with `spark.sql(...)`. Table names without a database in that SQL resolve against the session's current catalog and database, not against the namespace the view was created in. If the session is somewhere else, the query reads a same-named table from another database, or fails with `TABLE_OR_VIEW_NOT_FOUND`. Spark records the namespace of its own views in the `view.catalogAndNamespace.*` table properties, and Hive stores a qualified copy of the SQL as the view's expanded text. The connector uses neither. ### Error message and/or stacktrace ``` [TABLE_OR_VIEW_NOT_FOUND] The table or view `t` cannot be found. ``` ### How to reproduce In a Spark session with the Gravitino Hive catalog `hive` and the session catalog on the same metastore: ```sql USE spark_catalog.db1; CREATE VIEW db2.v AS SELECT * FROM t; -- t is db1.t USE spark_catalog.default; SELECT * FROM hive.db2.v; -- fails, or reads default.t ``` ### Additional context _No response_ -- 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]
