gatorsmile commented on a change in pull request #24774: [SPARK-27899][SQL]
Make HiveMetastoreClient.getTableObjectsByName available in
ExternalCatalog/SessionCatalog API
URL: https://github.com/apache/spark/pull/24774#discussion_r290824725
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala
##########
@@ -434,6 +434,31 @@ class SessionCatalog(
externalCatalog.getTable(db, table)
}
+ /**
+ * Retrieve all metadata of existing permanent tables/views. If no database
is specified,
+ * assume the table/view is in the current database.
+ * Only the tables/views belong to one same database that can be retrieved
are returned.
+ * For example, if none of the requested tables could be retrieved, an empty
list is returned.
+ * There is no guarantee of ordering of the returned tables.
+ */
+ @throws[NoSuchDatabaseException]
+ def getTablesByName(names: Seq[TableIdentifier]): Seq[CatalogTable] = {
+ if (names.nonEmpty) {
+ val dbs = names.map(_.database.getOrElse(getCurrentDatabase))
+ if (dbs.distinct.size != 1) {
+ throw new AnalysisException(
+ s"Only the tables/views belong to one same database can be
retrieved."
Review comment:
Let us list the input name list in the error message
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]