Github user gatorsmile commented on a diff in the pull request:
https://github.com/apache/spark/pull/16373#discussion_r105561082
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala ---
@@ -642,18 +644,34 @@ case class ShowTablesCommand(
// instead of calling tables in sparkSession.
val catalog = sparkSession.sessionState.catalog
val db = databaseName.getOrElse(catalog.getCurrentDatabase)
- val tables =
- tableIdentifierPattern.map(catalog.listTables(db,
_)).getOrElse(catalog.listTables(db))
- tables.map { tableIdent =>
- val database = tableIdent.database.getOrElse("")
- val tableName = tableIdent.table
- val isTemp = catalog.isTemporaryTable(tableIdent)
- if (isExtended) {
- val information =
catalog.getTempViewOrPermanentTableMetadata(tableIdent).toString
- Row(database, tableName, isTemp, s"${information}\n")
- } else {
- Row(database, tableName, isTemp)
+ if (partitionSpec.isEmpty) {
+ // Show the information of tables.
+ val tables =
+ tableIdentifierPattern.map(catalog.listTables(db,
_)).getOrElse(catalog.listTables(db))
+ tables.map { tableIdent =>
+ val database = tableIdent.database.getOrElse("")
+ val tableName = tableIdent.table
+ val isTemp = catalog.isTemporaryTable(tableIdent)
+ if (isExtended) {
+ val information =
catalog.getTempViewOrPermanentTableMetadata(tableIdent).toString
+ Row(database, tableName, isTemp, s"${information}\n")
+ } else {
+ Row(database, tableName, isTemp)
+ }
}
+ } else {
+ // Show the information of partitions.
+ //
+ // Note: tableIdentifierPattern should be non-empty, otherwise a
[[ParseException]]
+ // should have been thrown by the sql parser.
+ val tableIdentifier = TableIdentifier(tableIdentifierPattern.get,
Some(db))
--- End diff --
To be consistent, we can rename it to `tableIdent`
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]