Skip to content

Commit 07af901

Browse files
committed
Add escaped backtick test
1 parent 385f6d4 commit 07af901

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

sql/hive/src/test/scala/org/apache/spark/sql/hive/HiveQlSuite.scala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,4 +217,13 @@ class HiveQlSuite extends SparkFunSuite with BeforeAndAfterAll {
217217
|LATERAL VIEW explode(`gentab1`.`gencol1`) `gentab2` AS `gencol2`
218218
""".stripMargin)
219219
}
220+
221+
test("use escaped backticks in output of Generator") {
222+
val plan = parser.parsePlan(
223+
"""SELECT `gen``tab2`.`gen``col2`
224+
|FROM `default`.`src`
225+
|LATERAL VIEW explode(array(array(1, 2, 3))) `gen``tab1` AS `gen``col1`
226+
|LATERAL VIEW explode(`gen``tab1`.`gen``col1`) `gen``tab2` AS `gen``col2`
227+
""".stripMargin)
228+
}
220229
}

sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/SQLQuerySuite.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,10 @@ class SQLQuerySuite extends QueryTest with SQLTestUtils with TestHiveSingleton {
262262
checkAnswer(
263263
sql("SELECT `a`.`ints` FROM nestedArray LATERAL VIEW explode(a.b) `a` AS `ints`"),
264264
Row(1) :: Row(2) :: Row(3) :: Nil)
265+
266+
checkAnswer(
267+
sql("SELECT `weird``tab`.`weird``col` FROM nestedArray LATERAL VIEW explode(a.b) `weird``tab` AS `weird``col`"),
268+
Row(1) :: Row(2) :: Row(3) :: Nil)
265269
}
266270

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

0 commit comments

Comments
 (0)