-
Notifications
You must be signed in to change notification settings - Fork 28.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-10104][SQL] Consolidate different forms of table identifiers #8453
Conversation
Test build #41604 has finished for PR 8453 at commit
|
Test build #41605 has finished for PR 8453 at commit
|
de2736f
to
63f2f07
Compare
Test build #41607 has finished for PR 8453 at commit
|
Test build #41608 has finished for PR 8453 at commit
|
Test build #41610 has finished for PR 8453 at commit
|
Test build #41612 has finished for PR 8453 at commit
|
Test build #41617 has finished for PR 8453 at commit
|
Test build #41622 has finished for PR 8453 at commit
|
cc @yhuai |
Test build #41631 has finished for PR 8453 at commit
|
@cloud-fan Thank you for working on it. Since we are pretty close to 1.5 release, let's wait until the release and get this merged at the beginning of 1.6 release cycle. |
Test build #43207 has finished for PR 8453 at commit
|
retest this please. |
Test build #43208 has finished for PR 8453 at commit
|
Test build #43209 has finished for PR 8453 at commit
|
b73a696
to
71a7d54
Compare
Test build #43219 has finished for PR 8453 at commit
|
|
||
def toSeq: Seq[String] = database.toSeq :+ table | ||
def quotedString: String = database.map(db => s"`$db`.`$table`").getOrElse(s"`$table`") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$db may already have .
in it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the same behaviour of the original implementation def quotedString: String = toSeq.map("
" + _ + "``").mkString(".")`.
retest this please. |
Test build #43594 has finished for PR 8453 at commit
|
Test build #43601 has finished for PR 8453 at commit
|
Test build #43605 has finished for PR 8453 at commit
|
Test build #43613 has finished for PR 8453 at commit
|
Test build #43627 has finished for PR 8453 at commit
|
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('.'))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
is not the only character that need to be quoted, see http://stackoverflow.com/questions/4200351/what-characters-are-valid-in-an-sql-server-database-name
Test build #43659 has finished for PR 8453 at commit
|
Test build #43661 has finished for PR 8453 at commit
|
|
||
def toSeq: Seq[String] = database.toSeq :+ table | ||
override def toString: String = { | ||
if (table.contains('.') || database.exists(_.contains('.'))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some other character that need quote.
Test build #43681 has finished for PR 8453 at commit
|
Test build #43725 has finished for PR 8453 at commit
|
Test build #43733 has finished for PR 8453 at commit
|
Test build #43735 has finished for PR 8453 at commit
|
LGTM, merging this into master. |
Right now, we have QualifiedTableName, TableIdentifier, and Seq[String] to represent table identifiers. We should only have one form and TableIdentifier is the best one because it provides methods to get table name, database name, return unquoted string, and return quoted string.