aboutsummaryrefslogtreecommitdiff
path: root/sql/catalyst/src/test
diff options
context:
space:
mode:
authorgatorsmile <gatorsmile@gmail.com>2016-08-12 10:02:00 +0100
committerSean Owen <sowen@cloudera.com>2016-08-12 10:02:00 +0100
commit79e2caa1328843457841d71642b60be919ebb1e0 (patch)
treefa220c3122b03b264db197dc1611d7d59b7a30b2 /sql/catalyst/src/test
parentf4482225c405b9cfe078deac74e4c28e2dcc97c3 (diff)
downloadspark-79e2caa1328843457841d71642b60be919ebb1e0.tar.gz
spark-79e2caa1328843457841d71642b60be919ebb1e0.tar.bz2
spark-79e2caa1328843457841d71642b60be919ebb1e0.zip
[SPARK-16598][SQL][TEST] Added a test case for verifying the table identifier parsing
#### What changes were proposed in this pull request? So far, the test cases of `TableIdentifierParserSuite` do not cover the quoted cases. We should add one for avoiding regression. #### How was this patch tested? N/A Author: gatorsmile <gatorsmile@gmail.com> Closes #14244 from gatorsmile/quotedIdentifiers.
Diffstat (limited to 'sql/catalyst/src/test')
-rw-r--r--sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/parser/TableIdentifierParserSuite.scala8
1 files changed, 8 insertions, 0 deletions
diff --git a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/parser/TableIdentifierParserSuite.scala b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/parser/TableIdentifierParserSuite.scala
index 8bbf87e62d..dadb8a8def 100644
--- a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/parser/TableIdentifierParserSuite.scala
+++ b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/parser/TableIdentifierParserSuite.scala
@@ -68,6 +68,14 @@ class TableIdentifierParserSuite extends SparkFunSuite {
}
}
+ test("quoted identifiers") {
+ assert(TableIdentifier("z", Some("x.y")) === parseTableIdentifier("`x.y`.z"))
+ assert(TableIdentifier("y.z", Some("x")) === parseTableIdentifier("x.`y.z`"))
+ assert(TableIdentifier("z", Some("`x.y`")) === parseTableIdentifier("```x.y```.z"))
+ assert(TableIdentifier("`y.z`", Some("x")) === parseTableIdentifier("x.```y.z```"))
+ assert(TableIdentifier("x.y.z", None) === parseTableIdentifier("`x.y.z`"))
+ }
+
test("table identifier - strict keywords") {
// SQL Keywords.
hiveStrictNonReservedKeyword.foreach { keyword =>