Github user hvanhovell commented on a diff in the pull request:
https://github.com/apache/spark/pull/15403#discussion_r82506382
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/identifiers.scala ---
@@ -29,12 +28,23 @@ sealed trait IdentifierWithDatabase {
def database: Option[String]
+ /*
+ * Escapes back-ticks within the identifier name with double-back-ticks.
+ */
+ private def quoteIdentifier(name: String): String = name.replace("`",
"``")
+
def quotedString: String = {
- if (database.isDefined) s"`${database.get}`.`$identifier`" else
s"`$identifier`"
+ val replacedId = quoteIdentifier(identifier)
+ val replacedDb = database.map(quoteIdentifier(_))
+
+ if (replacedDb.isDefined) s"`${replacedDb.get}`.`$replacedId`" else
s"`$replacedId`"
}
def unquotedString: String = {
- if (database.isDefined) s"${database.get}.$identifier" else identifier
--- End diff --
I think we should keep `unquotedString ` this as it is. That gives some a
more readable (less parseable) version of the identifier. I just added an
example with `unquotedIdentifier` to show that there was no way to get a
parseable string from the table identifier.
---
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]