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

    https://github.com/apache/spark/pull/8453#discussion_r41781195
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/TableIdentifier.scala 
---
    @@ -20,14 +20,20 @@ package org.apache.spark.sql.catalyst
     /**
      * Identifies a `table` in `database`.  If `database` is not defined, the 
current database is used.
      */
    -private[sql] case class TableIdentifier(table: String, database: 
Option[String] = None) {
    -  def withDatabase(database: String): TableIdentifier = this.copy(database 
= Some(database))
    +private[sql] case class TableIdentifier(table: String, database: 
Option[String]) {
    +  override def toString: String = {
    +    if (table.contains('.') || database.exists(_.contains('.'))) {
    +      quotedString
    +    } else {
    +      unquotedString
    +    }
    +  }
     
    -  def toSeq: Seq[String] = database.toSeq :+ table
    +  def quotedString: String = database.map(db => 
s"`$db`.`$table`").getOrElse(s"`$table`")
     
    -  override def toString: String = quotedString
    -
    -  def quotedString: String = toSeq.map("`" + _ + "`").mkString(".")
    +  def unquotedString: String = database.map(db => 
s"$db.$table").getOrElse(table)
    +}
     
    -  def unquotedString: String = toSeq.mkString(".")
    +private[sql] object TableIdentifier {
    +  def apply(tableName: String): TableIdentifier = 
TableIdentifier(tableName, None)
    --- End diff --
    
    Why use this instead of default value?


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