wangyum commented on a change in pull request #22999: [SPARK-20319][SQL]
Already quoted identifiers are getting wrapped with additional quotes
URL: https://github.com/apache/spark/pull/22999#discussion_r244538619
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/jdbc/OracleDialect.scala
##########
@@ -81,6 +81,10 @@ private case object OracleDialect extends JdbcDialect {
case _ => None
}
+ override def quoteIdentifier(colName: String): String = {
+ s""""${colName.stripPrefix("\"").stripSuffix("\"")}""""
Review comment:
How about add `isSupportQuotedIdentifier` to `JdbcDialect`:
```scala
def isSupportQuotedIdentifier: Boolean = true
/**
* Quotes the identifier. This is used to put quotes around the identifier
in case the column
* name is a reserved keyword, or in case it contains characters that
require quotes (e.g. space).
*/
def quoteIdentifier(colName: String): String = {
if(!isSupportQuotedIdentifier) {
assert(!colName.startsWith("\"") || !colName.endsWith("\""),
"This dialect does not support quoted identifier.")
}
s""""$colName""""
}
```
`DB2Dialect`, `OracleDialect` and `PostgresDialect` should override it and
set it to `false`. `MySQLDialect` do not need override it.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]