aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbomeng <bmeng@us.ibm.com>2016-04-06 11:12:48 -0700
committerAndrew Or <andrew@databricks.com>2016-04-06 11:12:48 -0700
commit3c8d8821654e3d82ef927c55272348e1bcc34a79 (patch)
treef42930516a1715f427f5b27ce7c24a1188d059d0
parent5abd02c02b3fa3505defdc8ab0c5c5e23a16aa80 (diff)
downloadspark-3c8d8821654e3d82ef927c55272348e1bcc34a79.tar.gz
spark-3c8d8821654e3d82ef927c55272348e1bcc34a79.tar.bz2
spark-3c8d8821654e3d82ef927c55272348e1bcc34a79.zip
[SPARK-14383][SQL] missing "|" in the g4 file
## What changes were proposed in this pull request? A very trivial one. It missed "|" between DISTRIBUTE and UNSET. ## How was this patch tested? I do not think it is really needed. Author: bomeng <bmeng@us.ibm.com> Closes #12156 from bomeng/SPARK-14383.
-rw-r--r--sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g42
-rw-r--r--sql/core/src/test/scala/org/apache/spark/sql/execution/command/DDLCommandSuite.scala7
2 files changed, 8 insertions, 1 deletions
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 96c170be3d..8a45b4f2e1 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
@@ -645,7 +645,7 @@ nonReserved
| NO | DATA
| START | TRANSACTION | COMMIT | ROLLBACK | WORK | ISOLATION | LEVEL
| SNAPSHOT | READ | WRITE | ONLY
- | SORT | CLUSTER | DISTRIBUTE UNSET | TBLPROPERTIES | SKEWED | STORED | DIRECTORIES | LOCATION
+ | SORT | CLUSTER | DISTRIBUTE | UNSET | TBLPROPERTIES | SKEWED | STORED | DIRECTORIES | LOCATION
| EXCHANGE | ARCHIVE | UNARCHIVE | FILEFORMAT | TOUCH | COMPACT | CONCATENATE | CHANGE | FIRST
| AFTER | CASCADE | RESTRICT | BUCKETS | CLUSTERED | SORTED | PURGE | INPUTFORMAT | OUTPUTFORMAT
| INPUTDRIVER | OUTPUTDRIVER | DBPROPERTIES | DFS | TRUNCATE | METADATA | REPLICATION | COMPUTE
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/DDLCommandSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/DDLCommandSuite.scala
index 46dcadd690..8e63b69876 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/DDLCommandSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/DDLCommandSuite.scala
@@ -20,6 +20,7 @@ package org.apache.spark.sql.execution.command
import org.apache.spark.sql.catalyst.TableIdentifier
import org.apache.spark.sql.catalyst.parser.ParseException
import org.apache.spark.sql.catalyst.plans.PlanTest
+import org.apache.spark.sql.catalyst.plans.logical.{LogicalPlan, Project}
import org.apache.spark.sql.execution.SparkSqlParser
import org.apache.spark.sql.execution.datasources.BucketSpec
import org.apache.spark.sql.types._
@@ -685,4 +686,10 @@ class DDLCommandSuite extends PlanTest {
parser.parsePlan("SELECT TRANSFORM (key, value) USING 'cat' AS (tKey, tValue) FROM testData")
}
}
+
+ test("SPARK-14383: DISTRIBUTE and UNSET as non-keywords") {
+ val sql = "SELECT distribute, unset FROM x"
+ val parsed = parser.parsePlan(sql)
+ assert(parsed.isInstanceOf[Project])
+ }
}