Skip to content

Commit 2d1ab2d

Browse files
viiryacmonkey
authored andcommitted
[SPARK-16475][SQL] broadcast hint for SQL queries - disallow space as the delimiter
## What changes were proposed in this pull request? A follow-up to disallow space as the delimiter in broadcast hint. ## How was this patch tested? Jenkins test. Please review http://spark.apache.org/contributing.html before opening a pull request. Author: Liang-Chi Hsieh <[email protected]> Closes apache#16941 from viirya/disallow-space-delimiter.
1 parent 47dd3e1 commit 2d1ab2d

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,6 @@ hint
380380

381381
hintStatement
382382
: hintName=identifier
383-
| hintName=identifier '(' parameters+=identifier parameters+=identifier ')'
384383
| hintName=identifier '(' parameters+=identifier (',' parameters+=identifier)* ')'
385384
;
386385

sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/parser/PlanParserSuite.scala

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,13 @@ class PlanParserSuite extends PlanTest {
505505
val m2 = intercept[ParseException] {
506506
parsePlan("SELECT /*+ MAPJOIN(default.t) */ * from default.t")
507507
}.getMessage
508-
assert(m2.contains("no viable alternative at input"))
508+
assert(m2.contains("mismatched input '.' expecting {')', ','}"))
509+
510+
// Disallow space as the delimiter.
511+
val m3 = intercept[ParseException] {
512+
parsePlan("SELECT /*+ INDEX(a b c) */ * from default.t")
513+
}.getMessage
514+
assert(m3.contains("mismatched input 'b' expecting {')', ','}"))
509515

510516
comparePlans(
511517
parsePlan("SELECT /*+ HINT */ * FROM t"),
@@ -524,7 +530,7 @@ class PlanParserSuite extends PlanTest {
524530
Hint("STREAMTABLE", Seq("a", "b", "c"), table("t").select(star())))
525531

526532
comparePlans(
527-
parsePlan("SELECT /*+ INDEX(t emp_job_ix) */ * FROM t"),
533+
parsePlan("SELECT /*+ INDEX(t, emp_job_ix) */ * FROM t"),
528534
Hint("INDEX", Seq("t", "emp_job_ix"), table("t").select(star())))
529535

530536
comparePlans(

0 commit comments

Comments
 (0)