spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cloud-fan <...@git.apache.org>
Subject [GitHub] spark pull request #15423: [SPARK-17860][SQL] SHOW COLUMN's database conflic...
Date Tue, 18 Oct 2016 03:50:23 GMT
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/15423#discussion_r83777778
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala
---
    @@ -651,14 +651,28 @@ case class ShowTablePropertiesCommand(table: TableIdentifier, propertyKey:
Optio
      *   SHOW COLUMNS (FROM | IN) table_identifier [(FROM | IN) database];
      * }}}
      */
    -case class ShowColumnsCommand(tableName: TableIdentifier) extends RunnableCommand {
    +case class ShowColumnsCommand(
    +    databaseName: Option[String],
    +    tableName: TableIdentifier) extends RunnableCommand {
       override val output: Seq[Attribute] = {
         AttributeReference("col_name", StringType, nullable = false)() :: Nil
       }
     
    +  private def nameEqual(name1: String, name2: String, caseSensitive: Boolean): Boolean
= {
    +    if (caseSensitive) name1 == name2 else name1.equalsIgnoreCase(name2)
    +  }
    +
       override def run(sparkSession: SparkSession): Seq[Row] = {
         val catalog = sparkSession.sessionState.catalog
    -    val table = catalog.getTempViewOrPermanentTableMetadata(tableName)
    +    val caseSensitive = sparkSession.sessionState.conf.caseSensitiveAnalysis
    --- End diff --
    
    nit: we can simplify it to
    ```
    val resolver = sparkSession.sessionState.conf.resolver
    ...
    case Some(db) if tableName.database.exists(!resolver(_, db))
    ```


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

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


Mime
View raw message