Github user davies commented on a diff in the pull request: https://github.com/apache/spark/pull/8453#discussion_r41781068 --- 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`") --- End diff -- $db may already have `.` in it
--- 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