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

    https://github.com/apache/spark/pull/6745#discussion_r32119209
  
    --- Diff: 
sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/commands.scala ---
    @@ -256,3 +256,33 @@ case class CreateMetastoreDataSourceAsSelect(
         Seq.empty[Row]
       }
     }
    +
    +private[hive]
    +case class ShowTablesCommand(databaseName: Option[String], pattern: 
Option[String]) extends RunnableCommand {
    +
    +  // The result of SHOW TABLES has two columns, tableName and isTemporary.
    +  override val output: Seq[Attribute] = {
    +    val schema = StructType(
    +      StructField("tableName", StringType, false) ::
    +        StructField("isTemporary", BooleanType, false) :: Nil)
    +
    +    schema.toAttributes
    +  }
    +
    +  override def run(sqlContext: SQLContext): Seq[Row] = {
    +    // Since we need to return a Seq of rows, we will call getTables 
directly
    +    // instead of calling tables in sqlContext.
    +    val rows = pattern.isDefined match {
    --- End diff --
    
    Use `pattern.map(...).getOrElse(...)` instead.


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

Reply via email to