GitHub user jiangxb1987 opened a pull request:
https://github.com/apache/spark/pull/15403
[SPARK-17832][SQL] TableIdentifier.quotedString creates un-parseable names
when name contains a backtick
## What changes were proposed in this pull request?
The `quotedString` method in `TableIdentifier` and `FunctionIdentifier`
produce an illegal (un-parseable) name when the name contains a backtick. For
example:
```
import org.apache.spark.sql.catalyst.parser.CatalystSqlParser._
import org.apache.spark.sql.catalyst.TableIdentifier
import org.apache.spark.sql.catalyst.analysis.UnresolvedAttribute
val complexName = TableIdentifier("`weird`table`name", Some("`d`b`1"))
parseTableIdentifier(complexName.unquotedString) // Does not work
parseTableIdentifier(complexName.quotedString) // Does not work
parseExpression(complexName.unquotedString) // Does not work
parseExpression(complexName.quotedString) // Does not work
```
We should handle the backtick properly to make `quotedString` parseable.
## How was this patch tested?
Add new testcases in `TableIdentifierParserSuite` and
`ExpressionParserSuite`.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/jiangxb1987/spark backtick
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/15403.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #15403
----
commit a79f679298ef67f1791bab9ac6418998a0e01177
Author: jiangxingbo <[email protected]>
Date: 2016-10-08T08:07:07Z
TableIdentifier.quotedString creates tableNames correctly when it contains
backtick(s)
commit b12308212409c6db6c1bedacee228f7bdb47d3ec
Author: jiangxingbo <[email protected]>
Date: 2016-10-08T10:54:54Z
add testcases for function 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]