Github user jiangxb1987 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/16373#discussion_r100031009
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala ---
    @@ -619,18 +621,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")
    --- End diff --
    
    '''
    hive> create table t1(a int, b string) partitioned by (dt string, hour 
string);
    hive> alter table t1 add partition (dt='2017-02-08', hour='17');
    hive> alter table t1 add partition (dt='2017-02-08', hour='18');
    hive> show table extended like 't1' partition(dt='2017-02-08');
    FAILED: SemanticException [Error 10006]: Partition not found {dt=2017-02-08}
    hive> show table extended like 't1' partition(dt='2017-02-08', hour='17');
    OK
    tableName:t1
    owner:meituan
    location:hdfs://localhost:9000/user/hive/warehouse/t1/dt=2017-02-08/hour=17
    inputformat:org.apache.hadoop.mapred.TextInputFormat
    outputformat:org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
    columns:struct columns { i32 a, string b}
    partitioned:true
    partitionColumns:struct partition_columns { string dt, string hour}
    totalNumberFiles:0
    totalFileSize:0
    maxFileSize:0
    minFileSize:0
    lastAccessTime:0
    lastUpdateTime:1486548513945
    '''


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to