You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by rx...@apache.org on 2017/02/15 17:48:06 UTC

spark git commit: [SPARK-16475][SQL] broadcast hint for SQL queries - disallow space as the delimiter

Repository: spark
Updated Branches:
  refs/heads/master a8a139820 -> acf71c63c


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

Closes #16941 from viirya/disallow-space-delimiter.


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/acf71c63
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/acf71c63
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/acf71c63

Branch: refs/heads/master
Commit: acf71c63cdde8dced8d108260cdd35e1cc992248
Parents: a8a1398
Author: Liang-Chi Hsieh <vi...@gmail.com>
Authored: Wed Feb 15 18:48:02 2017 +0100
Committer: Reynold Xin <rx...@databricks.com>
Committed: Wed Feb 15 18:48:02 2017 +0100

----------------------------------------------------------------------
 .../org/apache/spark/sql/catalyst/parser/SqlBase.g4       |  1 -
 .../spark/sql/catalyst/parser/PlanParserSuite.scala       | 10 ++++++++--
 2 files changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/acf71c63/sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4
----------------------------------------------------------------------
diff --git a/sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4 b/sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4
index 0ac986d..d8cd68e 100644
--- a/sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4
+++ b/sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4
@@ -380,7 +380,6 @@ hint
 
 hintStatement
     : hintName=identifier
-    | hintName=identifier '(' parameters+=identifier parameters+=identifier ')'
     | hintName=identifier '(' parameters+=identifier (',' parameters+=identifier)* ')'
     ;
 

http://git-wip-us.apache.org/repos/asf/spark/blob/acf71c63/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/parser/PlanParserSuite.scala
----------------------------------------------------------------------
diff --git a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/parser/PlanParserSuite.scala b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/parser/PlanParserSuite.scala
index 13a84b4..2c14252 100644
--- a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/parser/PlanParserSuite.scala
+++ b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/parser/PlanParserSuite.scala
@@ -505,7 +505,13 @@ class PlanParserSuite extends PlanTest {
     val m2 = intercept[ParseException] {
       parsePlan("SELECT /*+ MAPJOIN(default.t) */ * from default.t")
     }.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(
       parsePlan("SELECT /*+ HINT */ * FROM t"),
@@ -524,7 +530,7 @@ class PlanParserSuite extends PlanTest {
       Hint("STREAMTABLE", Seq("a", "b", "c"), table("t").select(star())))
 
     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())))
 
     comparePlans(


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org