Skip to content
Snippets Groups Projects
Commit acf71c63 authored by Liang-Chi Hsieh's avatar Liang-Chi Hsieh Committed by Reynold Xin
Browse files

[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 <viirya@gmail.com>

Closes #16941 from viirya/disallow-space-delimiter.
parent a8a13982
No related branches found
No related tags found
No related merge requests found
...@@ -380,7 +380,6 @@ hint ...@@ -380,7 +380,6 @@ hint
hintStatement hintStatement
: hintName=identifier : hintName=identifier
| hintName=identifier '(' parameters+=identifier parameters+=identifier ')'
| hintName=identifier '(' parameters+=identifier (',' parameters+=identifier)* ')' | hintName=identifier '(' parameters+=identifier (',' parameters+=identifier)* ')'
; ;
......
...@@ -505,7 +505,13 @@ class PlanParserSuite extends PlanTest { ...@@ -505,7 +505,13 @@ class PlanParserSuite extends PlanTest {
val m2 = intercept[ParseException] { val m2 = intercept[ParseException] {
parsePlan("SELECT /*+ MAPJOIN(default.t) */ * from default.t") parsePlan("SELECT /*+ MAPJOIN(default.t) */ * from default.t")
}.getMessage }.getMessage
assert(m2.contains("no viable alternative at input")) assert(m2.contains("mismatched input '.' expecting {')', ','}"))
// Disallow space as the delimiter.
val m3 = intercept[ParseException] {
parsePlan("SELECT /*+ INDEX(a b c) */ * from default.t")
}.getMessage
assert(m3.contains("mismatched input 'b' expecting {')', ','}"))
comparePlans( comparePlans(
parsePlan("SELECT /*+ HINT */ * FROM t"), parsePlan("SELECT /*+ HINT */ * FROM t"),
...@@ -524,7 +530,7 @@ class PlanParserSuite extends PlanTest { ...@@ -524,7 +530,7 @@ class PlanParserSuite extends PlanTest {
Hint("STREAMTABLE", Seq("a", "b", "c"), table("t").select(star()))) Hint("STREAMTABLE", Seq("a", "b", "c"), table("t").select(star())))
comparePlans( comparePlans(
parsePlan("SELECT /*+ INDEX(t emp_job_ix) */ * FROM t"), parsePlan("SELECT /*+ INDEX(t, emp_job_ix) */ * FROM t"),
Hint("INDEX", Seq("t", "emp_job_ix"), table("t").select(star()))) Hint("INDEX", Seq("t", "emp_job_ix"), table("t").select(star())))
comparePlans( comparePlans(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment