Skip to content

Commit

Permalink
Add escaped backtick test
Browse files Browse the repository at this point in the history
  • Loading branch information
dilipbiswal committed Mar 8, 2016
1 parent 385f6d4 commit 07af901
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -217,4 +217,13 @@ class HiveQlSuite extends SparkFunSuite with BeforeAndAfterAll {
|LATERAL VIEW explode(`gentab1`.`gencol1`) `gentab2` AS `gencol2`
""".stripMargin)
}

test("use escaped backticks in output of Generator") {
val plan = parser.parsePlan(
"""SELECT `gen``tab2`.`gen``col2`
|FROM `default`.`src`
|LATERAL VIEW explode(array(array(1, 2, 3))) `gen``tab1` AS `gen``col1`
|LATERAL VIEW explode(`gen``tab1`.`gen``col1`) `gen``tab2` AS `gen``col2`
""".stripMargin)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,10 @@ class SQLQuerySuite extends QueryTest with SQLTestUtils with TestHiveSingleton {
checkAnswer(
sql("SELECT `a`.`ints` FROM nestedArray LATERAL VIEW explode(a.b) `a` AS `ints`"),
Row(1) :: Row(2) :: Row(3) :: Nil)

checkAnswer(
sql("SELECT `weird``tab`.`weird``col` FROM nestedArray LATERAL VIEW explode(a.b) `weird``tab` AS `weird``col`"),
Row(1) :: Row(2) :: Row(3) :: Nil)
}

test("SPARK-4512 Fix attribute reference resolution error when using SORT BY") {
Expand Down

0 comments on commit 07af901

Please sign in to comment.