You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ha...@apache.org on 2015/03/10 23:00:43 UTC

svn commit: r1665716 [1/7] - in /hive/trunk: common/src/java/org/apache/hadoop/hive/conf/ contrib/src/test/queries/clientnegative/ contrib/src/test/queries/clientpositive/ contrib/src/test/results/clientnegative/ contrib/src/test/results/clientpositive...

Author: hashutosh
Date: Tue Mar 10 22:00:41 2015
New Revision: 1665716

URL: http://svn.apache.org/r1665716
Log:
HIVE-6617 : Reduce ambiguity in grammar (Pengcheng Xiong via Ashutosh Chauhan)

Added:
    hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/parse/TestSQL11ReservedKeyWordsNegative.java
    hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/parse/TestSQL11ReservedKeyWordsPositive.java
    hive/trunk/ql/src/test/queries/clientpositive/ambiguitycheck.q
    hive/trunk/ql/src/test/results/clientpositive/ambiguitycheck.q.out
Modified:
    hive/trunk/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
    hive/trunk/contrib/src/test/queries/clientnegative/serde_regex.q
    hive/trunk/contrib/src/test/queries/clientpositive/serde_regex.q
    hive/trunk/contrib/src/test/results/clientnegative/serde_regex.q.out
    hive/trunk/contrib/src/test/results/clientpositive/serde_regex.q.out
    hive/trunk/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/security/TestStorageBasedMetastoreAuthorizationReads.java
    hive/trunk/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/security/authorization/plugin/TestHiveAuthorizerCheckInvocation.java
    hive/trunk/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/security/authorization/plugin/TestHiveAuthorizerShowFilters.java
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/FromClauseParser.g
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveLexer.g
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/ParseDriver.java
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SelectClauseParser.g
    hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/parse/TestIUD.java
    hive/trunk/ql/src/test/queries/clientnegative/serde_regex.q
    hive/trunk/ql/src/test/queries/clientnegative/serde_regex2.q
    hive/trunk/ql/src/test/queries/clientnegative/serde_regex3.q
    hive/trunk/ql/src/test/queries/clientpositive/array_map_access_nonconstant.q
    hive/trunk/ql/src/test/queries/clientpositive/decimal_10_0.q
    hive/trunk/ql/src/test/queries/clientpositive/dynamic_partition_pruning.q
    hive/trunk/ql/src/test/queries/clientpositive/innerjoin.q
    hive/trunk/ql/src/test/queries/clientpositive/keyword_1.q
    hive/trunk/ql/src/test/queries/clientpositive/nonreserved_keywords_input37.q
    hive/trunk/ql/src/test/queries/clientpositive/nonreserved_keywords_insert_into1.q
    hive/trunk/ql/src/test/queries/clientpositive/partition_wise_fileformat17.q
    hive/trunk/ql/src/test/queries/clientpositive/partition_wise_fileformat18.q
    hive/trunk/ql/src/test/queries/clientpositive/ppd_field_garbage.q
    hive/trunk/ql/src/test/queries/clientpositive/serde_regex.q
    hive/trunk/ql/src/test/queries/clientpositive/tez_union_group_by.q
    hive/trunk/ql/src/test/queries/clientpositive/union_remove_1.q
    hive/trunk/ql/src/test/queries/clientpositive/union_remove_10.q
    hive/trunk/ql/src/test/queries/clientpositive/union_remove_11.q
    hive/trunk/ql/src/test/queries/clientpositive/union_remove_12.q
    hive/trunk/ql/src/test/queries/clientpositive/union_remove_13.q
    hive/trunk/ql/src/test/queries/clientpositive/union_remove_14.q
    hive/trunk/ql/src/test/queries/clientpositive/union_remove_15.q
    hive/trunk/ql/src/test/queries/clientpositive/union_remove_16.q
    hive/trunk/ql/src/test/queries/clientpositive/union_remove_17.q
    hive/trunk/ql/src/test/queries/clientpositive/union_remove_18.q
    hive/trunk/ql/src/test/queries/clientpositive/union_remove_19.q
    hive/trunk/ql/src/test/queries/clientpositive/union_remove_2.q
    hive/trunk/ql/src/test/queries/clientpositive/union_remove_20.q
    hive/trunk/ql/src/test/queries/clientpositive/union_remove_21.q
    hive/trunk/ql/src/test/queries/clientpositive/union_remove_22.q
    hive/trunk/ql/src/test/queries/clientpositive/union_remove_23.q
    hive/trunk/ql/src/test/queries/clientpositive/union_remove_24.q
    hive/trunk/ql/src/test/queries/clientpositive/union_remove_25.q
    hive/trunk/ql/src/test/queries/clientpositive/union_remove_3.q
    hive/trunk/ql/src/test/queries/clientpositive/union_remove_4.q
    hive/trunk/ql/src/test/queries/clientpositive/union_remove_5.q
    hive/trunk/ql/src/test/queries/clientpositive/union_remove_6.q
    hive/trunk/ql/src/test/queries/clientpositive/union_remove_6_subq.q
    hive/trunk/ql/src/test/queries/clientpositive/union_remove_7.q
    hive/trunk/ql/src/test/queries/clientpositive/union_remove_8.q
    hive/trunk/ql/src/test/queries/clientpositive/union_remove_9.q
    hive/trunk/ql/src/test/queries/clientpositive/vector_decimal_10_0.q
    hive/trunk/ql/src/test/queries/clientpositive/vectorized_dynamic_partition_pruning.q
    hive/trunk/ql/src/test/results/clientnegative/authorization_cannot_create_all_role.q.out
    hive/trunk/ql/src/test/results/clientnegative/authorization_cannot_create_none_role.q.out
    hive/trunk/ql/src/test/results/clientnegative/lateral_view_join.q.out
    hive/trunk/ql/src/test/results/clientnegative/select_charliteral.q.out
    hive/trunk/ql/src/test/results/clientnegative/serde_regex.q.out
    hive/trunk/ql/src/test/results/clientnegative/serde_regex2.q.out
    hive/trunk/ql/src/test/results/clientnegative/serde_regex3.q.out
    hive/trunk/ql/src/test/results/clientpositive/array_map_access_nonconstant.q.out
    hive/trunk/ql/src/test/results/clientpositive/decimal_10_0.q.out
    hive/trunk/ql/src/test/results/clientpositive/innerjoin.q.out
    hive/trunk/ql/src/test/results/clientpositive/keyword_1.q.out
    hive/trunk/ql/src/test/results/clientpositive/nonreserved_keywords_input37.q.out
    hive/trunk/ql/src/test/results/clientpositive/nonreserved_keywords_insert_into1.q.out
    hive/trunk/ql/src/test/results/clientpositive/partition_wise_fileformat17.q.out
    hive/trunk/ql/src/test/results/clientpositive/partition_wise_fileformat18.q.out
    hive/trunk/ql/src/test/results/clientpositive/ppd_field_garbage.q.out
    hive/trunk/ql/src/test/results/clientpositive/serde_regex.q.out
    hive/trunk/ql/src/test/results/clientpositive/spark/innerjoin.q.out
    hive/trunk/ql/src/test/results/clientpositive/spark/union_remove_1.q.out
    hive/trunk/ql/src/test/results/clientpositive/spark/union_remove_10.q.out
    hive/trunk/ql/src/test/results/clientpositive/spark/union_remove_11.q.out
    hive/trunk/ql/src/test/results/clientpositive/spark/union_remove_15.q.out
    hive/trunk/ql/src/test/results/clientpositive/spark/union_remove_16.q.out
    hive/trunk/ql/src/test/results/clientpositive/spark/union_remove_17.q.out
    hive/trunk/ql/src/test/results/clientpositive/spark/union_remove_18.q.out
    hive/trunk/ql/src/test/results/clientpositive/spark/union_remove_19.q.out
    hive/trunk/ql/src/test/results/clientpositive/spark/union_remove_2.q.out
    hive/trunk/ql/src/test/results/clientpositive/spark/union_remove_20.q.out
    hive/trunk/ql/src/test/results/clientpositive/spark/union_remove_21.q.out
    hive/trunk/ql/src/test/results/clientpositive/spark/union_remove_24.q.out
    hive/trunk/ql/src/test/results/clientpositive/spark/union_remove_25.q.out
    hive/trunk/ql/src/test/results/clientpositive/spark/union_remove_3.q.out
    hive/trunk/ql/src/test/results/clientpositive/spark/union_remove_4.q.out
    hive/trunk/ql/src/test/results/clientpositive/spark/union_remove_5.q.out
    hive/trunk/ql/src/test/results/clientpositive/spark/union_remove_6.q.out
    hive/trunk/ql/src/test/results/clientpositive/spark/union_remove_7.q.out
    hive/trunk/ql/src/test/results/clientpositive/spark/union_remove_8.q.out
    hive/trunk/ql/src/test/results/clientpositive/spark/union_remove_9.q.out
    hive/trunk/ql/src/test/results/clientpositive/tez/dynamic_partition_pruning.q.out
    hive/trunk/ql/src/test/results/clientpositive/tez/tez_union_group_by.q.out
    hive/trunk/ql/src/test/results/clientpositive/tez/vector_decimal_10_0.q.out
    hive/trunk/ql/src/test/results/clientpositive/tez/vectorized_dynamic_partition_pruning.q.out
    hive/trunk/ql/src/test/results/clientpositive/union_remove_1.q.out
    hive/trunk/ql/src/test/results/clientpositive/union_remove_10.q.out
    hive/trunk/ql/src/test/results/clientpositive/union_remove_11.q.out
    hive/trunk/ql/src/test/results/clientpositive/union_remove_12.q.out
    hive/trunk/ql/src/test/results/clientpositive/union_remove_13.q.out
    hive/trunk/ql/src/test/results/clientpositive/union_remove_14.q.out
    hive/trunk/ql/src/test/results/clientpositive/union_remove_15.q.out
    hive/trunk/ql/src/test/results/clientpositive/union_remove_16.q.out
    hive/trunk/ql/src/test/results/clientpositive/union_remove_17.q.out
    hive/trunk/ql/src/test/results/clientpositive/union_remove_18.q.out
    hive/trunk/ql/src/test/results/clientpositive/union_remove_19.q.out
    hive/trunk/ql/src/test/results/clientpositive/union_remove_2.q.out
    hive/trunk/ql/src/test/results/clientpositive/union_remove_20.q.out
    hive/trunk/ql/src/test/results/clientpositive/union_remove_21.q.out
    hive/trunk/ql/src/test/results/clientpositive/union_remove_22.q.out
    hive/trunk/ql/src/test/results/clientpositive/union_remove_23.q.out
    hive/trunk/ql/src/test/results/clientpositive/union_remove_24.q.out
    hive/trunk/ql/src/test/results/clientpositive/union_remove_25.q.out
    hive/trunk/ql/src/test/results/clientpositive/union_remove_3.q.out
    hive/trunk/ql/src/test/results/clientpositive/union_remove_4.q.out
    hive/trunk/ql/src/test/results/clientpositive/union_remove_5.q.out
    hive/trunk/ql/src/test/results/clientpositive/union_remove_6.q.out
    hive/trunk/ql/src/test/results/clientpositive/union_remove_6_subq.q.out
    hive/trunk/ql/src/test/results/clientpositive/union_remove_7.q.out
    hive/trunk/ql/src/test/results/clientpositive/union_remove_8.q.out
    hive/trunk/ql/src/test/results/clientpositive/union_remove_9.q.out
    hive/trunk/ql/src/test/results/clientpositive/vector_decimal_10_0.q.out

Modified: hive/trunk/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
URL: http://svn.apache.org/viewvc/hive/trunk/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java?rev=1665716&r1=1665715&r2=1665716&view=diff
==============================================================================
--- hive/trunk/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java (original)
+++ hive/trunk/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java Tue Mar 10 22:00:41 2015
@@ -1954,7 +1954,9 @@ public class HiveConf extends Configurat
         "  none: default(past) behavior. Implies only alphaNumeric and underscore are valid characters in identifiers.\n" +
         "  column: implies column names can contain any character."
     ),
-
+    HIVE_SUPPORT_SQL11_RESERVED_KEYWORDS("hive.support.sql11.reserved.keywords", true,
+        "This flag should be set to true to enable support for SQL2011 reserved keywords.\n" +
+        "The default value is true."),
     // role names are case-insensitive
     USERS_IN_ADMIN_ROLE("hive.users.in.admin.role", "", false,
         "Comma separated list of users who are in admin role for bootstrapping.\n" +

Modified: hive/trunk/contrib/src/test/queries/clientnegative/serde_regex.q
URL: http://svn.apache.org/viewvc/hive/trunk/contrib/src/test/queries/clientnegative/serde_regex.q?rev=1665716&r1=1665715&r2=1665716&view=diff
==============================================================================
--- hive/trunk/contrib/src/test/queries/clientnegative/serde_regex.q (original)
+++ hive/trunk/contrib/src/test/queries/clientnegative/serde_regex.q Tue Mar 10 22:00:41 2015
@@ -7,7 +7,7 @@ EXPLAIN
 CREATE TABLE serde_regex(
   host STRING,
   identity STRING,
-  user STRING,
+  `user` STRING,
   time STRING,
   request STRING,
   status INT,
@@ -24,7 +24,7 @@ STORED AS TEXTFILE;
 CREATE TABLE serde_regex(
   host STRING,
   identity STRING,
-  user STRING,
+  `user` STRING,
   time STRING,
   request STRING,
   status INT,

Modified: hive/trunk/contrib/src/test/queries/clientpositive/serde_regex.q
URL: http://svn.apache.org/viewvc/hive/trunk/contrib/src/test/queries/clientpositive/serde_regex.q?rev=1665716&r1=1665715&r2=1665716&view=diff
==============================================================================
--- hive/trunk/contrib/src/test/queries/clientpositive/serde_regex.q (original)
+++ hive/trunk/contrib/src/test/queries/clientpositive/serde_regex.q Tue Mar 10 22:00:41 2015
@@ -4,7 +4,7 @@ EXPLAIN
 CREATE TABLE serde_regex(
   host STRING,
   identity STRING,
-  user STRING,
+  `user` STRING,
   time STRING,
   request STRING,
   status STRING,
@@ -21,7 +21,7 @@ STORED AS TEXTFILE;
 CREATE TABLE serde_regex(
   host STRING,
   identity STRING,
-  user STRING,
+  `user` STRING,
   time STRING,
   request STRING,
   status STRING,

Modified: hive/trunk/contrib/src/test/results/clientnegative/serde_regex.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/contrib/src/test/results/clientnegative/serde_regex.q.out?rev=1665716&r1=1665715&r2=1665716&view=diff
==============================================================================
--- hive/trunk/contrib/src/test/results/clientnegative/serde_regex.q.out (original)
+++ hive/trunk/contrib/src/test/results/clientnegative/serde_regex.q.out Tue Mar 10 22:00:41 2015
@@ -9,7 +9,7 @@ EXPLAIN
 CREATE TABLE serde_regex(
   host STRING,
   identity STRING,
-  user STRING,
+  `user` STRING,
   time STRING,
   request STRING,
   status INT,
@@ -28,7 +28,7 @@ EXPLAIN
 CREATE TABLE serde_regex(
   host STRING,
   identity STRING,
-  user STRING,
+  `user` STRING,
   time STRING,
   request STRING,
   status INT,
@@ -61,7 +61,7 @@ STAGE PLANS:
 PREHOOK: query: CREATE TABLE serde_regex(
   host STRING,
   identity STRING,
-  user STRING,
+  `user` STRING,
   time STRING,
   request STRING,
   status INT,

Modified: hive/trunk/contrib/src/test/results/clientpositive/serde_regex.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/contrib/src/test/results/clientpositive/serde_regex.q.out?rev=1665716&r1=1665715&r2=1665716&view=diff
==============================================================================
--- hive/trunk/contrib/src/test/results/clientpositive/serde_regex.q.out (original)
+++ hive/trunk/contrib/src/test/results/clientpositive/serde_regex.q.out Tue Mar 10 22:00:41 2015
@@ -2,7 +2,7 @@ PREHOOK: query: EXPLAIN
 CREATE TABLE serde_regex(
   host STRING,
   identity STRING,
-  user STRING,
+  `user` STRING,
   time STRING,
   request STRING,
   status STRING,
@@ -20,7 +20,7 @@ POSTHOOK: query: EXPLAIN
 CREATE TABLE serde_regex(
   host STRING,
   identity STRING,
-  user STRING,
+  `user` STRING,
   time STRING,
   request STRING,
   status STRING,
@@ -53,7 +53,7 @@ STAGE PLANS:
 PREHOOK: query: CREATE TABLE serde_regex(
   host STRING,
   identity STRING,
-  user STRING,
+  `user` STRING,
   time STRING,
   request STRING,
   status STRING,
@@ -72,7 +72,7 @@ PREHOOK: Output: default@serde_regex
 POSTHOOK: query: CREATE TABLE serde_regex(
   host STRING,
   identity STRING,
-  user STRING,
+  `user` STRING,
   time STRING,
   request STRING,
   status STRING,

Modified: hive/trunk/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/security/TestStorageBasedMetastoreAuthorizationReads.java
URL: http://svn.apache.org/viewvc/hive/trunk/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/security/TestStorageBasedMetastoreAuthorizationReads.java?rev=1665716&r1=1665715&r2=1665716&view=diff
==============================================================================
--- hive/trunk/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/security/TestStorageBasedMetastoreAuthorizationReads.java (original)
+++ hive/trunk/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/security/TestStorageBasedMetastoreAuthorizationReads.java Tue Mar 10 22:00:41 2015
@@ -60,7 +60,7 @@ public class TestStorageBasedMetastoreAu
     setPermissions(db.getLocationUri(), "-rwxrwxrwx");
 
     String dbDotTable = dbName + "." + tblName;
-    resp = driver.run("create table " + dbDotTable + "(i int) partitioned by (date string)");
+    resp = driver.run("create table " + dbDotTable + "(i int) partitioned by (`date` string)");
     Assert.assertEquals(0, resp.getResponseCode());
     Table tab = msc.getTable(dbName, tblName);
     setPermissions(tab.getSd().getLocation(), perm);

Modified: hive/trunk/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/security/authorization/plugin/TestHiveAuthorizerCheckInvocation.java
URL: http://svn.apache.org/viewvc/hive/trunk/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/security/authorization/plugin/TestHiveAuthorizerCheckInvocation.java?rev=1665716&r1=1665715&r2=1665716&view=diff
==============================================================================
--- hive/trunk/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/security/authorization/plugin/TestHiveAuthorizerCheckInvocation.java (original)
+++ hive/trunk/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/security/authorization/plugin/TestHiveAuthorizerCheckInvocation.java Tue Mar 10 22:00:41 2015
@@ -94,7 +94,7 @@ public class TestHiveAuthorizerCheckInvo
     SessionState.start(conf);
     driver = new Driver(conf);
     runCmd("create table " + tableName
-        + " (i int, j int, k string) partitioned by (city string, date string) ");
+        + " (i int, j int, k string) partitioned by (city string, `date` string) ");
     runCmd("create database " + dbName);
     // Need a separate table for ACID testing since it has to be bucketed and it has to be Acid
     runCmd("create table " + acidTableName + " (i int, j int) clustered by (i) into 2 buckets " +

Modified: hive/trunk/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/security/authorization/plugin/TestHiveAuthorizerShowFilters.java
URL: http://svn.apache.org/viewvc/hive/trunk/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/security/authorization/plugin/TestHiveAuthorizerShowFilters.java?rev=1665716&r1=1665715&r2=1665716&view=diff
==============================================================================
--- hive/trunk/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/security/authorization/plugin/TestHiveAuthorizerShowFilters.java (original)
+++ hive/trunk/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/security/authorization/plugin/TestHiveAuthorizerShowFilters.java Tue Mar 10 22:00:41 2015
@@ -123,7 +123,7 @@ public class TestHiveAuthorizerShowFilte
     SessionState.start(conf);
     driver = new Driver(conf);
     runCmd("create table " + tableName1
-        + " (i int, j int, k string) partitioned by (city string, date string) ");
+        + " (i int, j int, k string) partitioned by (city string, `date` string) ");
     runCmd("create table " + tableName2 + "(i int)");
 
     runCmd("create database " + dbName1);

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/FromClauseParser.g
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/FromClauseParser.g?rev=1665716&r1=1665715&r2=1665716&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/FromClauseParser.g (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/FromClauseParser.g Tue Mar 10 22:00:41 2015
@@ -35,6 +35,9 @@ k=3;
       RecognitionException e) {
     gParent.errors.add(new ParseError(gParent, e, tokenNames));
   }
+  protected boolean useSQL11ReservedKeywordsForIdentifier() {
+    return gParent.useSQL11ReservedKeywordsForIdentifier();
+  }
 }
 
 @rulecatch {
@@ -126,7 +129,7 @@ lateralView
 @init {gParent.pushMsg("lateral view", state); }
 @after {gParent.popMsg(state); }
 	:
-	KW_LATERAL KW_VIEW KW_OUTER function tableAlias (KW_AS identifier ((COMMA)=> COMMA identifier)*)?
+	(KW_LATERAL KW_VIEW KW_OUTER) => KW_LATERAL KW_VIEW KW_OUTER function tableAlias (KW_AS identifier ((COMMA)=> COMMA identifier)*)?
 	-> ^(TOK_LATERAL_VIEW_OUTER ^(TOK_SELECT ^(TOK_SELEXPR function identifier* tableAlias)))
 	|
 	KW_LATERAL KW_VIEW function tableAlias (KW_AS identifier ((COMMA)=> COMMA identifier)*)?
@@ -177,7 +180,12 @@ tableSample
 tableSource
 @init { gParent.pushMsg("table source", state); }
 @after { gParent.popMsg(state); }
-    : tabname=tableName (props=tableProperties)? (ts=tableSample)? (KW_AS? alias=Identifier)?
+    : tabname=tableName 
+    ((tableProperties) => props=tableProperties)?
+    ((tableSample) => ts=tableSample)? 
+    ((KW_AS) => (KW_AS alias=Identifier) 
+    |
+    (Identifier) => (alias=Identifier))?
     -> ^(TOK_TABREF $tabname $props? $ts? $alias?)
     ;
 
@@ -232,11 +240,11 @@ partitionedTableFunction
 @init { gParent.pushMsg("ptf clause", state); }
 @after { gParent.popMsg(state); } 
    :
-   name=Identifier
-   LPAREN KW_ON ptfsrc=partitionTableFunctionSource partitioningSpec?
-     ((Identifier LPAREN expression RPAREN ) => Identifier LPAREN expression RPAREN ( COMMA Identifier LPAREN expression RPAREN)*)? 
-   RPAREN alias=Identifier?
-   ->   ^(TOK_PTBLFUNCTION $name $alias? partitionTableFunctionSource partitioningSpec? expression*)
+   name=Identifier LPAREN KW_ON 
+   ((partitionTableFunctionSource) => (ptfsrc=partitionTableFunctionSource spec=partitioningSpec?))
+   ((Identifier LPAREN expression RPAREN ) => Identifier LPAREN expression RPAREN ( COMMA Identifier LPAREN expression RPAREN)*)?
+   ((RPAREN) => (RPAREN)) ((Identifier) => alias=Identifier)?
+   ->   ^(TOK_PTBLFUNCTION $name $alias? $ptfsrc $spec? expression*)
    ; 
 
 //----------------------- Rules for parsing whereClause -----------------------------

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveLexer.g
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveLexer.g?rev=1665716&r1=1665715&r2=1665716&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveLexer.g (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveLexer.g Tue Mar 10 22:00:41 2015
@@ -42,7 +42,6 @@ KW_TRUE : 'TRUE';
 KW_FALSE : 'FALSE';
 KW_ALL : 'ALL';
 KW_NONE: 'NONE';
-KW_DEFAULT : 'DEFAULT';
 KW_AND : 'AND';
 KW_OR : 'OR';
 KW_NOT : 'NOT' | '!';

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g?rev=1665716&r1=1665715&r2=1665716&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g Tue Mar 10 22:00:41 2015
@@ -354,6 +354,8 @@ package org.apache.hadoop.hive.ql.parse;
 
 import java.util.Collection;
 import java.util.HashMap;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hive.conf.HiveConf;
 }
 
 
@@ -370,7 +372,6 @@ import java.util.HashMap;
     xlateMap.put("KW_FALSE", "FALSE");
     xlateMap.put("KW_ALL", "ALL");
     xlateMap.put("KW_NONE", "NONE");
-    xlateMap.put("KW_DEFAULT", "DEFAULT");
     xlateMap.put("KW_AND", "AND");
     xlateMap.put("KW_OR", "OR");
     xlateMap.put("KW_NOT", "NOT");
@@ -620,6 +621,13 @@ import java.util.HashMap;
   private CommonTree throwSetOpException() throws RecognitionException {
     throw new FailedPredicateException(input, "orderByClause clusterByClause distributeByClause sortByClause limitClause can only be applied to the whole union.", "");
   }
+  private Configuration hiveConf;
+  public void setHiveConf(Configuration hiveConf) {
+    this.hiveConf = hiveConf;
+  }
+  protected boolean useSQL11ReservedKeywordsForIdentifier() {
+    return !HiveConf.getBoolVar(hiveConf, HiveConf.ConfVars.HIVE_SUPPORT_SQL11_RESERVED_KEYWORDS);
+  }
 }
 
 @rulecatch {
@@ -712,8 +720,8 @@ ddlStatement
     | unlockDatabase
     | createRoleStatement
     | dropRoleStatement
-    | grantPrivileges
-    | revokePrivileges
+    | (grantPrivileges) => grantPrivileges
+    | (revokePrivileges) => revokePrivileges
     | showGrants
     | showRoleGrants
     | showRolePrincipals
@@ -955,8 +963,7 @@ alterStatement
 alterTableStatementSuffix
 @init { pushMsg("alter table statement", state); }
 @after { popMsg(state); }
-    : alterStatementSuffixRename[true]
-    | alterStatementSuffixUpdateStatsCol
+    : (alterStatementSuffixRename[true]) => alterStatementSuffixRename[true]
     | alterStatementSuffixDropPartitions[true]
     | alterStatementSuffixAddPartitions[true]
     | alterStatementSuffixTouch
@@ -1297,15 +1304,15 @@ fileFormat
 tabTypeExpr
 @init { pushMsg("specifying table types", state); }
 @after { popMsg(state); }
-
-   : identifier (DOT^ (KW_ELEM_TYPE | KW_KEY_TYPE | KW_VALUE_TYPE | identifier))*
-   ;
-
-descTabTypeExpr
-@init { pushMsg("specifying describe table types", state); }
-@after { popMsg(state); }
-
-   : identifier (DOT^ (KW_ELEM_TYPE | KW_KEY_TYPE | KW_VALUE_TYPE | identifier))* identifier?
+   : identifier (DOT^ 
+   (
+   (KW_ELEM_TYPE) => KW_ELEM_TYPE
+   | 
+   (KW_KEY_TYPE) => KW_KEY_TYPE
+   | 
+   (KW_VALUE_TYPE) => KW_VALUE_TYPE 
+   | identifier
+   ))* identifier?
    ;
 
 partTypeExpr
@@ -1314,21 +1321,22 @@ partTypeExpr
     :  tabTypeExpr partitionSpec? -> ^(TOK_TABTYPE tabTypeExpr partitionSpec?)
     ;
 
-descPartTypeExpr
-@init { pushMsg("specifying describe table partitions", state); }
-@after { popMsg(state); }
-    :  descTabTypeExpr partitionSpec? -> ^(TOK_TABTYPE descTabTypeExpr partitionSpec?)
-    ;
-
 descStatement
 @init { pushMsg("describe statement", state); }
 @after { popMsg(state); }
-    : (KW_DESCRIBE|KW_DESC) (KW_DATABASE|KW_SCHEMA) KW_EXTENDED? (dbName=identifier) -> ^(TOK_DESCDATABASE $dbName KW_EXTENDED?)
-    | (KW_DESCRIBE|KW_DESC) (descOptions=KW_FORMATTED|descOptions=KW_EXTENDED|descOptions=KW_PRETTY)? (parttype=descPartTypeExpr) -> ^(TOK_DESCTABLE $parttype $descOptions?)
-    | (KW_DESCRIBE|KW_DESC) KW_FUNCTION KW_EXTENDED? (name=descFuncNames) -> ^(TOK_DESCFUNCTION $name KW_EXTENDED?)
+    :
+    (KW_DESCRIBE|KW_DESC)
+    (
+    (KW_DATABASE|KW_SCHEMA) => (KW_DATABASE|KW_SCHEMA) KW_EXTENDED? (dbName=identifier) -> ^(TOK_DESCDATABASE $dbName KW_EXTENDED?)
+    |
+    (KW_FUNCTION) => KW_FUNCTION KW_EXTENDED? (name=descFuncNames) -> ^(TOK_DESCFUNCTION $name KW_EXTENDED?)
+    |
+    (KW_FORMATTED|KW_EXTENDED|KW_PRETTY) => ((descOptions=KW_FORMATTED|descOptions=KW_EXTENDED|descOptions=KW_PRETTY) parttype=partTypeExpr) -> ^(TOK_DESCTABLE $parttype $descOptions)
+    |
+    parttype=partTypeExpr -> ^(TOK_DESCTABLE $parttype)
+    )
     ;
 
-
 analyzeStatement
 @init { pushMsg("analyze statement", state); }
 @after { popMsg(state); }
@@ -1350,8 +1358,12 @@ showStatement
     | KW_SHOW KW_TABLE KW_EXTENDED ((KW_FROM|KW_IN) db_name=identifier)? KW_LIKE showStmtIdentifier partitionSpec?
     -> ^(TOK_SHOW_TABLESTATUS showStmtIdentifier $db_name? partitionSpec?)
     | KW_SHOW KW_TBLPROPERTIES tableName (LPAREN prptyName=StringLiteral RPAREN)? -> ^(TOK_SHOW_TBLPROPERTIES tableName $prptyName?)
-    | KW_SHOW KW_LOCKS (parttype=partTypeExpr)? (isExtended=KW_EXTENDED)? -> ^(TOK_SHOWLOCKS $parttype? $isExtended?)
-    | KW_SHOW KW_LOCKS (KW_DATABASE|KW_SCHEMA) (dbName=Identifier) (isExtended=KW_EXTENDED)? -> ^(TOK_SHOWDBLOCKS $dbName $isExtended?)
+    | KW_SHOW KW_LOCKS 
+      (
+      (KW_DATABASE|KW_SCHEMA) => (KW_DATABASE|KW_SCHEMA) (dbName=Identifier) (isExtended=KW_EXTENDED)? -> ^(TOK_SHOWDBLOCKS $dbName $isExtended?)
+      |
+      (parttype=partTypeExpr)? (isExtended=KW_EXTENDED)? -> ^(TOK_SHOWLOCKS $parttype? $isExtended?)
+      )
     | KW_SHOW (showOptions=KW_FORMATTED)? (KW_INDEX|KW_INDEXES) KW_ON showStmtIdentifier ((KW_FROM|KW_IN) db_name=identifier)?
     -> ^(TOK_SHOWINDEXES showStmtIdentifier $showOptions? $db_name?)
     | KW_SHOW KW_COMPACTIONS -> ^(TOK_SHOW_COMPACTIONS)
@@ -1459,8 +1471,12 @@ showCurrentRole
 setRole
 @init {pushMsg("set role", state);}
 @after {popMsg(state);}
-    : KW_SET KW_ROLE roleName=identifier
-    -> ^(TOK_SHOW_SET_ROLE $roleName)
+    : KW_SET KW_ROLE 
+    (
+    (KW_ALL) => (all=KW_ALL) -> ^(TOK_SHOW_SET_ROLE Identifier[$all.text])
+    |
+    identifier -> ^(TOK_SHOW_SET_ROLE identifier)
+    )
     ;
 
 showGrants
@@ -1481,7 +1497,7 @@ showRolePrincipals
 privilegeIncludeColObject
 @init {pushMsg("privilege object including columns", state);}
 @after {popMsg(state);}
-    : KW_ALL -> ^(TOK_RESOURCE_ALL)
+    : (KW_ALL) => KW_ALL -> ^(TOK_RESOURCE_ALL)
     | privObjectCols -> ^(TOK_PRIV_OBJECT_COL privObjectCols)
     ;
 
@@ -1720,7 +1736,7 @@ tableSkewed
 @init { pushMsg("table skewed specification", state); }
 @after { popMsg(state); }
     :
-     KW_SKEWED KW_BY LPAREN skewedCols=columnNameList RPAREN KW_ON LPAREN (skewedValues=skewedValueElement) RPAREN (storedAsDirs)?
+     KW_SKEWED KW_BY LPAREN skewedCols=columnNameList RPAREN KW_ON LPAREN (skewedValues=skewedValueElement) RPAREN ((storedAsDirs) => storedAsDirs)?
     -> ^(TOK_TABLESKEWED $skewedCols $skewedValues storedAsDirs?)
     ;
 
@@ -1851,7 +1867,7 @@ tableFileFormat
 @init { pushMsg("table file format specification", state); }
 @after { popMsg(state); }
     :
-      KW_STORED KW_AS KW_INPUTFORMAT inFmt=StringLiteral KW_OUTPUTFORMAT outFmt=StringLiteral (KW_INPUTDRIVER inDriver=StringLiteral KW_OUTPUTDRIVER outDriver=StringLiteral)?
+      (KW_STORED KW_AS KW_INPUTFORMAT) => KW_STORED KW_AS KW_INPUTFORMAT inFmt=StringLiteral KW_OUTPUTFORMAT outFmt=StringLiteral (KW_INPUTDRIVER inDriver=StringLiteral KW_OUTPUTDRIVER outDriver=StringLiteral)?
       -> ^(TOK_TABLEFILEFORMAT $inFmt $outFmt $inDriver? $outDriver?)
       | KW_STORED KW_BY storageHandler=StringLiteral
          (KW_WITH KW_SERDEPROPERTIES serdeprops=tableProperties)?
@@ -2231,7 +2247,7 @@ simpleSelectStatement
    whereClause?
    groupByClause?
    havingClause?
-   window_clause?
+   ((window_clause) => window_clause)?
    -> ^(TOK_QUERY fromClause? ^(TOK_INSERT ^(TOK_DESTINATION ^(TOK_DIR TOK_TMP_FILE))
                      selectClause whereClause? groupByClause? havingClause? window_clause?))
    ;

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g?rev=1665716&r1=1665715&r2=1665716&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g Tue Mar 10 22:00:41 2015
@@ -35,6 +35,9 @@ k=3;
       RecognitionException e) {
     gParent.errors.add(new ParseError(gParent, e, tokenNames));
   }
+  protected boolean useSQL11ReservedKeywordsForIdentifier() {
+    return gParent.useSQL11ReservedKeywordsForIdentifier();
+  }
 }
 
 @rulecatch {
@@ -51,40 +54,41 @@ groupByClause
 @after { gParent.popMsg(state); }
     :
     KW_GROUP KW_BY
-    groupByExpression
-    ( COMMA groupByExpression )*
+    expression
+    ( COMMA expression)*
     ((rollup=KW_WITH KW_ROLLUP) | (cube=KW_WITH KW_CUBE)) ?
     (sets=KW_GROUPING KW_SETS 
     LPAREN groupingSetExpression ( COMMA groupingSetExpression)*  RPAREN ) ?
-    -> {rollup != null}? ^(TOK_ROLLUP_GROUPBY groupByExpression+)
-    -> {cube != null}? ^(TOK_CUBE_GROUPBY groupByExpression+)
-    -> {sets != null}? ^(TOK_GROUPING_SETS groupByExpression+ groupingSetExpression+)
-    -> ^(TOK_GROUPBY groupByExpression+)
+    -> {rollup != null}? ^(TOK_ROLLUP_GROUPBY expression+)
+    -> {cube != null}? ^(TOK_CUBE_GROUPBY expression+)
+    -> {sets != null}? ^(TOK_GROUPING_SETS expression+ groupingSetExpression+)
+    -> ^(TOK_GROUPBY expression+)
     ;
 
 groupingSetExpression
 @init {gParent.pushMsg("grouping set expression", state); }
 @after {gParent.popMsg(state); }
    :
-   groupByExpression
-   -> ^(TOK_GROUPING_SETS_EXPRESSION groupByExpression)
+   (LPAREN) => groupingSetExpressionMultiple 
    |
+   groupingExpressionSingle
+   ;
+
+groupingSetExpressionMultiple
+@init {gParent.pushMsg("grouping set part expression", state); }
+@after {gParent.popMsg(state); }
+   :
    LPAREN 
-   groupByExpression (COMMA groupByExpression)*
+   expression? (COMMA expression)*
    RPAREN
-   -> ^(TOK_GROUPING_SETS_EXPRESSION groupByExpression+)
-   |
-   LPAREN
-   RPAREN
-   -> ^(TOK_GROUPING_SETS_EXPRESSION)
+   -> ^(TOK_GROUPING_SETS_EXPRESSION expression*)
    ;
 
-
-groupByExpression
-@init { gParent.pushMsg("group by expression", state); }
+groupingExpressionSingle
+@init { gParent.pushMsg("groupingExpression expression", state); }
 @after { gParent.popMsg(state); }
     :
-    expression
+    expression -> ^(TOK_GROUPING_SETS_EXPRESSION expression)
     ;
 
 havingClause
@@ -101,6 +105,26 @@ havingCondition
     expression
     ;
 
+expressionsInParenthese
+    :
+    LPAREN expression (COMMA expression)* RPAREN -> expression+
+    ;
+
+expressionsNotInParenthese
+    :
+    expression (COMMA expression)* -> expression+
+    ;
+
+columnRefOrderInParenthese
+    :
+    LPAREN columnRefOrder (COMMA columnRefOrder)* RPAREN -> columnRefOrder+
+    ;
+
+columnRefOrderNotInParenthese
+    :
+    columnRefOrder (COMMA columnRefOrder)* -> columnRefOrder+
+    ;
+    
 // order by a,b
 orderByClause
 @init { gParent.pushMsg("order by clause", state); }
@@ -108,17 +132,17 @@ orderByClause
     :
     KW_ORDER KW_BY columnRefOrder ( COMMA columnRefOrder)* -> ^(TOK_ORDERBY columnRefOrder+)
     ;
-
+    
 clusterByClause
 @init { gParent.pushMsg("cluster by clause", state); }
 @after { gParent.popMsg(state); }
     :
     KW_CLUSTER KW_BY
-    LPAREN expression (COMMA expression)* RPAREN -> ^(TOK_CLUSTERBY expression+)
+    (
+    (LPAREN) => expressionsInParenthese -> ^(TOK_CLUSTERBY expressionsInParenthese)
     |
-    KW_CLUSTER KW_BY
-    expression
-    ( (COMMA)=>COMMA expression )* -> ^(TOK_CLUSTERBY expression+)
+    expressionsNotInParenthese -> ^(TOK_CLUSTERBY expressionsNotInParenthese)
+    )
     ;
 
 partitionByClause
@@ -126,10 +150,11 @@ partitionByClause
 @after { gParent.popMsg(state); }
     :
     KW_PARTITION KW_BY
-    LPAREN expression (COMMA expression)* RPAREN -> ^(TOK_DISTRIBUTEBY expression+)
+    (
+    (LPAREN) => expressionsInParenthese -> ^(TOK_DISTRIBUTEBY expressionsInParenthese)
     |
-    KW_PARTITION KW_BY
-    expression ((COMMA)=> COMMA expression)* -> ^(TOK_DISTRIBUTEBY expression+)
+    expressionsNotInParenthese -> ^(TOK_DISTRIBUTEBY expressionsNotInParenthese)
+    )
     ;
 
 distributeByClause
@@ -137,10 +162,11 @@ distributeByClause
 @after { gParent.popMsg(state); }
     :
     KW_DISTRIBUTE KW_BY
-    LPAREN expression (COMMA expression)* RPAREN -> ^(TOK_DISTRIBUTEBY expression+)
+    (
+    (LPAREN) => expressionsInParenthese -> ^(TOK_DISTRIBUTEBY expressionsInParenthese)
     |
-    KW_DISTRIBUTE KW_BY
-    expression ((COMMA)=> COMMA expression)* -> ^(TOK_DISTRIBUTEBY expression+)
+    expressionsNotInParenthese -> ^(TOK_DISTRIBUTEBY expressionsNotInParenthese)
+    )
     ;
 
 sortByClause
@@ -148,12 +174,11 @@ sortByClause
 @after { gParent.popMsg(state); }
     :
     KW_SORT KW_BY
-    LPAREN columnRefOrder
-    ( COMMA columnRefOrder)* RPAREN -> ^(TOK_SORTBY columnRefOrder+)
+    (
+    (LPAREN) => columnRefOrderInParenthese -> ^(TOK_SORTBY columnRefOrderInParenthese)
     |
-    KW_SORT KW_BY
-    columnRefOrder
-    ( (COMMA)=> COMMA columnRefOrder)* -> ^(TOK_SORTBY columnRefOrder+)
+    columnRefOrderNotInParenthese -> ^(TOK_SORTBY columnRefOrderNotInParenthese)
+    )
     ;
 
 // fun(par1, par2, par3)
@@ -164,7 +189,7 @@ function
     functionName
     LPAREN
       (
-        (star=STAR)
+        (STAR) => (star=STAR)
         | (dist=KW_DISTINCT)? (selectExpression (COMMA selectExpression)*)?
       )
     RPAREN (KW_OVER ws=window_specification)?
@@ -173,29 +198,15 @@ function
                             -> ^(TOK_FUNCTIONDI functionName (selectExpression+)?)
     ;
 
-nonParenthesizedFunction
-@init { gParent.pushMsg("non-parenthesized function name", state); }
-@after { gParent.popMsg(state); }
-    :
-    nonParenthesizedFunctionName
-        -> ^(TOK_FUNCTION nonParenthesizedFunctionName)
-    ;
-
-nonParenthesizedFunctionName
-@init { gParent.pushMsg("non-parenthesized function name", state); }
-@after { gParent.popMsg(state); }
-    :
-    KW_CURRENT_DATE | KW_CURRENT_TIMESTAMP
-    ;
-
 functionName
 @init { gParent.pushMsg("function name", state); }
 @after { gParent.popMsg(state); }
     : // Keyword IF is also a function name
-    KW_IF | KW_ARRAY | KW_MAP | KW_STRUCT | KW_UNIONTYPE | functionIdentifier
+    (KW_IF | KW_ARRAY | KW_MAP | KW_STRUCT | KW_UNIONTYPE) => (KW_IF | KW_ARRAY | KW_MAP | KW_STRUCT | KW_UNIONTYPE)
+    | 
+    (functionIdentifier) => functionIdentifier
     |
-    // This allows current_timestamp() to work as well as current_timestamp
-    nonParenthesizedFunctionName
+    {!useSQL11ReservedKeywordsForIdentifier()}? sql11ReservedKeywordsUsedAsCastFunctionName -> Identifier[$sql11ReservedKeywordsUsedAsCastFunctionName.text]
     ;
 
 castExpression
@@ -267,6 +278,8 @@ dateLiteral
       // This makes the dateLiteral more consistent with the other type literals.
       adaptor.create(TOK_DATELITERAL, $StringLiteral.text)
     }
+    |
+    KW_CURRENT_DATE -> ^(TOK_FUNCTION KW_CURRENT_DATE)
     ;
 
 timestampLiteral
@@ -275,6 +288,8 @@ timestampLiteral
     {
       adaptor.create(TOK_TIMESTAMPLITERAL, $StringLiteral.text)
     }
+    |
+    KW_CURRENT_TIMESTAMP -> ^(TOK_FUNCTION KW_CURRENT_TIMESTAMP)
     ;
 
 expression
@@ -286,12 +301,11 @@ expression
 
 atomExpression
     :
-    KW_NULL -> TOK_NULL
-    | constant
+    (KW_NULL) => KW_NULL -> TOK_NULL
+    | (constant) => constant
     | castExpression
     | caseExpression
     | whenExpression
-    | nonParenthesizedFunction
     | (functionName LPAREN) => function
     | tableOrColumn
     | LPAREN! expression RPAREN!
@@ -543,7 +557,7 @@ sysFuncNames
 
 descFuncNames
     :
-      sysFuncNames
+      (sysFuncNames) => sysFuncNames
     | StringLiteral
     | functionIdentifier
     ;
@@ -552,6 +566,9 @@ identifier
     :
     Identifier
     | nonReserved -> Identifier[$nonReserved.text]
+    // If it decides to support SQL11 reserved keywords, i.e., useSQL11ReservedKeywordsForIdentifier()=false, 
+    // the sql11keywords in existing q tests will NOT be added back.
+    | {useSQL11ReservedKeywordsForIdentifier()}? sql11ReservedKeywordsUsedAsIdentifier -> Identifier[$sql11ReservedKeywordsUsedAsIdentifier.text]
     ;
 
 functionIdentifier
@@ -570,7 +587,44 @@ principalIdentifier
     | QuotedIdentifier
     ;
 
+//the new version of nonReserved + sql11ReservedKeywordsUsedAsIdentifier = old version of nonReserved 
 nonReserved
     :
-    KW_TRUE | KW_FALSE | KW_LIKE | KW_EXISTS | KW_ASC | KW_DESC | KW_ORDER | KW_GROUP | KW_BY | KW_AS | KW_INSERT | KW_OVERWRITE | KW_OUTER | KW_LEFT | KW_RIGHT | KW_FULL | KW_PARTITION | KW_PARTITIONS | KW_TABLE | KW_TABLES | KW_COLUMNS | KW_INDEX | KW_INDEXES | KW_REBUILD | KW_FUNCTIONS | KW_SHOW | KW_MSCK | KW_REPAIR | KW_DIRECTORY | KW_LOCAL | KW_USING | KW_CLUSTER | KW_DISTRIBUTE | KW_SORT | KW_LOAD | KW_EXPORT | KW_IMPORT | KW_DATA | KW_INPATH | KW_IS | KW_NULL | KW_CREATE | KW_EXTERNAL | KW_ALTER | KW_CHANGE | KW_FIRST | KW_AFTER | KW_DESCRIBE | KW_DROP | KW_RENAME | KW_IGNORE | KW_PROTECTION | KW_TO | KW_COMMENT | KW_BOOLEAN | KW_TINYINT | KW_SMALLINT | KW_INT | KW_BIGINT | KW_FLOAT | KW_DOUBLE | KW_DATE | KW_DATETIME | KW_TIMESTAMP | KW_DECIMAL | KW_STRING | KW_ARRAY | KW_STRUCT | KW_UNIONTYPE | KW_PARTITIONED | KW_CLUSTERED | KW_SORTED | KW_INTO | KW_BUCKETS | KW_ROW | KW_ROWS | KW_FORMAT | KW_DELIMITED | KW_FIELDS | KW_TERMINATED | KW_ESCAPED | KW_COLLECTION | KW_ITEMS | 
 KW_KEYS | KW_KEY_TYPE | KW_LINES | KW_STORED | KW_FILEFORMAT | KW_INPUTFORMAT | KW_OUTPUTFORMAT | KW_INPUTDRIVER | KW_OUTPUTDRIVER | KW_OFFLINE | KW_ENABLE | KW_DISABLE | KW_READONLY | KW_NO_DROP | KW_LOCATION | KW_BUCKET | KW_OUT | KW_OF | KW_PERCENT | KW_ADD | KW_REPLACE | KW_RLIKE | KW_REGEXP | KW_TEMPORARY | KW_EXPLAIN | KW_FORMATTED | KW_PRETTY | KW_DEPENDENCY | KW_LOGICAL | KW_SERDE | KW_WITH | KW_DEFERRED | KW_SERDEPROPERTIES | KW_DBPROPERTIES | KW_LIMIT | KW_SET | KW_UNSET | KW_TBLPROPERTIES | KW_IDXPROPERTIES | KW_VALUE_TYPE | KW_ELEM_TYPE | KW_MAPJOIN | KW_STREAMTABLE | KW_HOLD_DDLTIME | KW_CLUSTERSTATUS | KW_UTC | KW_UTCTIMESTAMP | KW_LONG | KW_DELETE | KW_PLUS | KW_MINUS | KW_FETCH | KW_INTERSECT | KW_VIEW | KW_IN | KW_DATABASES | KW_MATERIALIZED | KW_SCHEMA | KW_SCHEMAS | KW_GRANT | KW_REVOKE | KW_SSL | KW_UNDO | KW_LOCK | KW_LOCKS | KW_UNLOCK | KW_SHARED | KW_EXCLUSIVE | KW_PROCEDURE | KW_UNSIGNED | KW_WHILE | KW_READ | KW_READS | KW_PURGE | KW_RANGE | KW_ANALYZE | KW_
 BEFORE | KW_BETWEEN | KW_BOTH | KW_BINARY | KW_CONTINUE | KW_CURSOR | KW_TRIGGER | KW_RECORDREADER | KW_RECORDWRITER | KW_SEMI | KW_LATERAL | KW_TOUCH | KW_ARCHIVE | KW_UNARCHIVE | KW_COMPUTE | KW_STATISTICS | KW_USE | KW_OPTION | KW_CONCATENATE | KW_SHOW_DATABASE | KW_UPDATE | KW_RESTRICT | KW_CASCADE | KW_SKEWED | KW_ROLLUP | KW_CUBE | KW_DIRECTORIES | KW_FOR | KW_GROUPING | KW_SETS | KW_TRUNCATE | KW_NOSCAN | KW_USER | KW_ROLE | KW_ROLES | KW_INNER | KW_DEFINED | KW_ADMIN | KW_JAR | KW_FILE | KW_OWNER | KW_PRINCIPALS | KW_ALL | KW_DEFAULT | KW_NONE | KW_COMPACT | KW_COMPACTIONS | KW_TRANSACTIONS | KW_REWRITE | KW_AUTHORIZATION | KW_VALUES | KW_URI | KW_SERVER | KW_RELOAD
+    KW_ADD | KW_ADMIN | KW_AFTER | KW_ANALYZE | KW_ARCHIVE | KW_ASC | KW_BEFORE | KW_BUCKET | KW_BUCKETS
+    | KW_CASCADE | KW_CHANGE | KW_CLUSTER | KW_CLUSTERED | KW_CLUSTERSTATUS | KW_COLLECTION | KW_COLUMNS
+    | KW_COMMENT | KW_COMPACT | KW_COMPACTIONS | KW_COMPUTE | KW_CONCATENATE | KW_CONTINUE | KW_DATA 
+    | KW_DATABASES | KW_DATETIME | KW_DBPROPERTIES | KW_DEFERRED | KW_DEFINED | KW_DELIMITED | KW_DEPENDENCY 
+    | KW_DESC | KW_DIRECTORIES | KW_DIRECTORY | KW_DISABLE | KW_DISTRIBUTE | KW_ELEM_TYPE 
+    | KW_ENABLE | KW_ESCAPED | KW_EXCLUSIVE | KW_EXPLAIN | KW_EXPORT | KW_FIELDS | KW_FILE | KW_FILEFORMAT
+    | KW_FIRST | KW_FORMAT | KW_FORMATTED | KW_FUNCTIONS | KW_HOLD_DDLTIME | KW_IDXPROPERTIES | KW_IGNORE
+    | KW_INDEX | KW_INDEXES | KW_INPATH | KW_INPUTDRIVER | KW_INPUTFORMAT | KW_ITEMS | KW_JAR
+    | KW_KEYS | KW_KEY_TYPE | KW_LIMIT | KW_LINES | KW_LOAD | KW_LOCATION | KW_LOCK | KW_LOCKS | KW_LOGICAL | KW_LONG
+    | KW_MAPJOIN | KW_MATERIALIZED | KW_MINUS | KW_MSCK | KW_NOSCAN | KW_NO_DROP | KW_OFFLINE | KW_OPTION
+    | KW_OUTPUTDRIVER | KW_OUTPUTFORMAT | KW_OVERWRITE | KW_OWNER | KW_PARTITIONED | KW_PARTITIONS | KW_PLUS | KW_PRETTY | KW_PRINCIPALS
+    | KW_PROTECTION | KW_PURGE | KW_READ | KW_READONLY | KW_REBUILD | KW_RECORDREADER | KW_RECORDWRITER
+    | KW_REGEXP | KW_RELOAD | KW_RENAME | KW_REPAIR | KW_REPLACE | KW_RESTRICT | KW_REWRITE | KW_RLIKE
+    | KW_ROLE | KW_ROLES | KW_SCHEMA | KW_SCHEMAS | KW_SEMI | KW_SERDE | KW_SERDEPROPERTIES | KW_SERVER | KW_SETS | KW_SHARED
+    | KW_SHOW | KW_SHOW_DATABASE | KW_SKEWED | KW_SORT | KW_SORTED | KW_SSL | KW_STATISTICS | KW_STORED
+    | KW_STREAMTABLE | KW_STRING | KW_STRUCT | KW_TABLES | KW_TBLPROPERTIES | KW_TEMPORARY | KW_TERMINATED
+    | KW_TINYINT | KW_TOUCH | KW_TRANSACTIONS | KW_UNARCHIVE | KW_UNDO | KW_UNIONTYPE | KW_UNLOCK | KW_UNSET
+    | KW_UNSIGNED | KW_URI | KW_USE | KW_UTC | KW_UTCTIMESTAMP | KW_VALUE_TYPE | KW_VIEW | KW_WHILE
+    ;
+
+//The following SQL2011 reserved keywords are used as cast function name only, it is a subset of the sql11ReservedKeywordsUsedAsIdentifier.
+sql11ReservedKeywordsUsedAsCastFunctionName
+    :
+    KW_BIGINT | KW_BINARY | KW_BOOLEAN | KW_CURRENT_DATE | KW_CURRENT_TIMESTAMP | KW_DATE | KW_DOUBLE | KW_FLOAT | KW_INT | KW_SMALLINT | KW_TIMESTAMP
+    ;
+
+//The following SQL2011 reserved keywords are used as identifiers in many q tests, they may be added back due to backward compatibility.
+sql11ReservedKeywordsUsedAsIdentifier
+    :
+    KW_ALL | KW_ALTER | KW_ARRAY | KW_AS | KW_AUTHORIZATION | KW_BETWEEN | KW_BIGINT | KW_BINARY | KW_BOOLEAN 
+    | KW_BOTH | KW_BY | KW_CREATE | KW_CUBE | KW_CURRENT_DATE | KW_CURRENT_TIMESTAMP | KW_CURSOR | KW_DATE | KW_DECIMAL | KW_DELETE | KW_DESCRIBE 
+    | KW_DOUBLE | KW_DROP | KW_EXISTS | KW_EXTERNAL | KW_FALSE | KW_FETCH | KW_FLOAT | KW_FOR | KW_FULL | KW_GRANT 
+    | KW_GROUP | KW_GROUPING | KW_IMPORT | KW_IN | KW_INNER | KW_INSERT | KW_INT | KW_INTERSECT | KW_INTO | KW_IS | KW_LATERAL 
+    | KW_LEFT | KW_LIKE | KW_LOCAL | KW_NONE | KW_NULL | KW_OF | KW_ORDER | KW_OUT | KW_OUTER | KW_PARTITION 
+    | KW_PERCENT | KW_PROCEDURE | KW_RANGE | KW_READS | KW_REVOKE | KW_RIGHT 
+    | KW_ROLLUP | KW_ROW | KW_ROWS | KW_SET | KW_SMALLINT | KW_TABLE | KW_TIMESTAMP | KW_TO | KW_TRIGGER | KW_TRUE 
+    | KW_TRUNCATE | KW_UNION | KW_UPDATE | KW_USER | KW_USING | KW_VALUES | KW_WITH
     ;

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/ParseDriver.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/ParseDriver.java?rev=1665716&r1=1665715&r2=1665716&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/ParseDriver.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/ParseDriver.java Tue Mar 10 22:00:41 2015
@@ -193,6 +193,9 @@ public class ParseDriver {
       lexer.setHiveConf(ctx.getConf());
     }
     HiveParser parser = new HiveParser(tokens);
+    if (ctx != null) {
+      parser.setHiveConf(ctx.getConf());
+    }
     parser.setTreeAdaptor(adaptor);
     HiveParser.statement_return r = null;
     try {

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SelectClauseParser.g
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SelectClauseParser.g?rev=1665716&r1=1665715&r2=1665716&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SelectClauseParser.g (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SelectClauseParser.g Tue Mar 10 22:00:41 2015
@@ -35,6 +35,9 @@ k=3;
       RecognitionException e) {
     gParent.errors.add(new ParseError(gParent, e, tokenNames));
   }
+  protected boolean useSQL11ReservedKeywordsForIdentifier() {
+    return gParent.useSQL11ReservedKeywordsForIdentifier();
+  }
 }
 
 @rulecatch {
@@ -125,10 +128,11 @@ selectItem
 @init { gParent.pushMsg("selection target", state); }
 @after { gParent.popMsg(state); }
     :
+    (tableAllColumns) => tableAllColumns -> ^(TOK_SELEXPR tableAllColumns)
+    |
     ( expression
       ((KW_AS? identifier) | (KW_AS LPAREN identifier (COMMA identifier)* RPAREN))?
     ) -> ^(TOK_SELEXPR expression identifier*)
-    | tableAllColumns -> ^(TOK_SELEXPR tableAllColumns)
     ;
 
 trfmClause
@@ -148,7 +152,9 @@ selectExpression
 @init { gParent.pushMsg("select expression", state); }
 @after { gParent.popMsg(state); }
     :
-    expression | tableAllColumns
+    (tableAllColumns) => tableAllColumns
+    |
+    expression
     ;
 
 selectExpressionList

Modified: hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/parse/TestIUD.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/parse/TestIUD.java?rev=1665716&r1=1665715&r2=1665716&view=diff
==============================================================================
--- hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/parse/TestIUD.java (original)
+++ hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/parse/TestIUD.java Tue Mar 10 22:00:41 2015
@@ -17,7 +17,10 @@
  */
 package org.apache.hadoop.hive.ql.parse;
 
+import java.io.IOException;
+
 import org.apache.hadoop.hive.conf.HiveConf;
+import org.apache.hadoop.hive.ql.Context;
 import org.apache.hadoop.hive.ql.session.SessionState;
 import org.junit.Assert;
 import org.junit.Before;
@@ -31,7 +34,6 @@ public class TestIUD {
   private static HiveConf conf;
 
   private ParseDriver pd;
-  private SemanticAnalyzer sA;
 
   @BeforeClass
   public static void initialize() {
@@ -40,15 +42,20 @@ public class TestIUD {
   }
 
   @Before
-  public void setup() throws SemanticException {
+  public void setup() throws SemanticException, IOException {
     pd = new ParseDriver();
-    sA = new CalcitePlanner(conf);
   }
 
   ASTNode parse(String query) throws ParseException {
-    ASTNode nd = pd.parse(query);
+    ASTNode nd = null;
+    try {
+      nd = pd.parse(query, new Context(conf));
+    } catch (IOException e) {
+      e.printStackTrace();
+    }
     return (ASTNode) nd.getChild(0);
   }
+  
   @Test
   public void testDeleteNoWhere() throws ParseException {
     ASTNode ast = parse("DELETE FROM src");
@@ -147,11 +154,11 @@ public class TestIUD {
   @Test
   public void testSelectStarFromAnonymousVirtTable1Row() throws ParseException {
     try {
-      parse("select * from values (3,4)");
+      parse("select * from `values` (3,4)");
       Assert.assertFalse("Expected ParseException", true);
     }
     catch(ParseException ex) {
-      Assert.assertEquals("Failure didn't match.", "line 1:21 missing EOF at '(' near 'values'",ex.getMessage());
+      Assert.assertEquals("Failure didn't match.", "line 1:23 missing EOF at '(' near 'values'",ex.getMessage());
     }
   }
   @Test

Added: hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/parse/TestSQL11ReservedKeyWordsNegative.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/parse/TestSQL11ReservedKeyWordsNegative.java?rev=1665716&view=auto
==============================================================================
--- hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/parse/TestSQL11ReservedKeyWordsNegative.java (added)
+++ hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/parse/TestSQL11ReservedKeyWordsNegative.java Tue Mar 10 22:00:41 2015
@@ -0,0 +1,1073 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hive.ql.parse;
+
+import java.io.IOException;
+
+import org.apache.hadoop.hive.conf.HiveConf;
+import org.apache.hadoop.hive.conf.HiveConf.ConfVars;
+import org.apache.hadoop.hive.ql.Context;
+import org.apache.hadoop.hive.ql.session.SessionState;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Parser tests for SQL11 Reserved KeyWords. Please find more information in
+ * HIVE-6617. Total number : 74
+ */
+public class TestSQL11ReservedKeyWordsNegative {
+  private static HiveConf conf;
+
+  private ParseDriver pd;
+
+  @BeforeClass
+  public static void initialize() {
+    conf = new HiveConf(SemanticAnalyzer.class);
+    conf.setBoolVar(ConfVars.HIVE_SUPPORT_SQL11_RESERVED_KEYWORDS, true);
+    SessionState.start(conf);
+  }
+
+  @Before
+  public void setup() throws SemanticException, IOException {
+    pd = new ParseDriver();
+  }
+
+  ASTNode parse(String query) throws ParseException {
+    ASTNode nd = null;
+    try {
+      nd = pd.parse(query, new Context(conf));
+    } catch (IOException e) {
+      e.printStackTrace();
+    }
+    return (ASTNode) nd.getChild(0);
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_ALL() {
+    try {
+      parse("CREATE TABLE ALL (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert.assertEquals("Failure didn't match.",
+          "line 1:13 Failed to recognize predicate 'ALL'. Failed rule: 'identifier' in table name",
+          ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_ALTER() {
+    try {
+      parse("CREATE TABLE ALTER (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'ALTER'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_ARRAY() {
+    try {
+      parse("CREATE TABLE ARRAY (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'ARRAY'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_AS() {
+    try {
+      parse("CREATE TABLE AS (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert.assertEquals("Failure didn't match.",
+          "line 1:13 Failed to recognize predicate 'AS'. Failed rule: 'identifier' in table name",
+          ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_AUTHORIZATION() {
+    try {
+      parse("CREATE TABLE AUTHORIZATION (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'AUTHORIZATION'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_BETWEEN() {
+    try {
+      parse("CREATE TABLE BETWEEN (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'BETWEEN'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_BIGINT() {
+    try {
+      parse("CREATE TABLE BIGINT (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'BIGINT'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_BINARY() {
+    try {
+      parse("CREATE TABLE BINARY (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'BINARY'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_BOOLEAN() {
+    try {
+      parse("CREATE TABLE BOOLEAN (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'BOOLEAN'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_BOTH() {
+    try {
+      parse("CREATE TABLE BOTH (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'BOTH'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_BY() {
+    try {
+      parse("CREATE TABLE BY (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert.assertEquals("Failure didn't match.",
+          "line 1:13 Failed to recognize predicate 'BY'. Failed rule: 'identifier' in table name",
+          ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_CREATE() {
+    try {
+      parse("CREATE TABLE CREATE (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'CREATE'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_CUBE() {
+    try {
+      parse("CREATE TABLE CUBE (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'CUBE'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_CURRENT_DATE() {
+    try {
+      parse("CREATE TABLE CURRENT_DATE (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'CURRENT_DATE'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_CURRENT_TIMESTAMP() {
+    try {
+      parse("CREATE TABLE CURRENT_TIMESTAMP (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'CURRENT_TIMESTAMP'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_CURSOR() {
+    try {
+      parse("CREATE TABLE CURSOR (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'CURSOR'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_DATE() {
+    try {
+      parse("CREATE TABLE DATE (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'DATE'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_DECIMAL() {
+    try {
+      parse("CREATE TABLE DECIMAL (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'DECIMAL'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_DELETE() {
+    try {
+      parse("CREATE TABLE DELETE (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'DELETE'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_DESCRIBE() {
+    try {
+      parse("CREATE TABLE DESCRIBE (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'DESCRIBE'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_DOUBLE() {
+    try {
+      parse("CREATE TABLE DOUBLE (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'DOUBLE'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_DROP() {
+    try {
+      parse("CREATE TABLE DROP (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'DROP'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_EXISTS() {
+    try {
+      parse("CREATE TABLE EXISTS (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'EXISTS'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_EXTERNAL() {
+    try {
+      parse("CREATE TABLE EXTERNAL (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'EXTERNAL'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_FALSE() {
+    try {
+      parse("CREATE TABLE FALSE (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'FALSE'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_FETCH() {
+    try {
+      parse("CREATE TABLE FETCH (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'FETCH'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_FLOAT() {
+    try {
+      parse("CREATE TABLE FLOAT (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'FLOAT'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_FOR() {
+    try {
+      parse("CREATE TABLE FOR (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert.assertEquals("Failure didn't match.",
+          "line 1:13 Failed to recognize predicate 'FOR'. Failed rule: 'identifier' in table name",
+          ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_FULL() {
+    try {
+      parse("CREATE TABLE FULL (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'FULL'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_GRANT() {
+    try {
+      parse("CREATE TABLE GRANT (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'GRANT'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_GROUP() {
+    try {
+      parse("CREATE TABLE GROUP (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'GROUP'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_GROUPING() {
+    try {
+      parse("CREATE TABLE GROUPING (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'GROUPING'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_IMPORT() {
+    try {
+      parse("CREATE TABLE IMPORT (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'IMPORT'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_IN() {
+    try {
+      parse("CREATE TABLE IN (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert.assertEquals("Failure didn't match.",
+          "line 1:13 Failed to recognize predicate 'IN'. Failed rule: 'identifier' in table name",
+          ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_INNER() {
+    try {
+      parse("CREATE TABLE INNER (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'INNER'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_INSERT() {
+    try {
+      parse("CREATE TABLE INSERT (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'INSERT'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_INT() {
+    try {
+      parse("CREATE TABLE INT (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert.assertEquals("Failure didn't match.",
+          "line 1:13 Failed to recognize predicate 'INT'. Failed rule: 'identifier' in table name",
+          ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_INTERSECT() {
+    try {
+      parse("CREATE TABLE INTERSECT (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'INTERSECT'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_INTO() {
+    try {
+      parse("CREATE TABLE INTO (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'INTO'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_IS() {
+    try {
+      parse("CREATE TABLE IS (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert.assertEquals("Failure didn't match.",
+          "line 1:13 Failed to recognize predicate 'IS'. Failed rule: 'identifier' in table name",
+          ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_LATERAL() {
+    try {
+      parse("CREATE TABLE LATERAL (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'LATERAL'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_LEFT() {
+    try {
+      parse("CREATE TABLE LEFT (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'LEFT'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_LIKE() {
+    try {
+      parse("CREATE TABLE LIKE (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'LIKE'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_LOCAL() {
+    try {
+      parse("CREATE TABLE LOCAL (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'LOCAL'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_NONE() {
+    try {
+      parse("CREATE TABLE NONE (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'NONE'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_NULL() {
+    try {
+      parse("CREATE TABLE NULL (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'NULL'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_OF() {
+    try {
+      parse("CREATE TABLE OF (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert.assertEquals("Failure didn't match.",
+          "line 1:13 Failed to recognize predicate 'OF'. Failed rule: 'identifier' in table name",
+          ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_ORDER() {
+    try {
+      parse("CREATE TABLE ORDER (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'ORDER'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_OUT() {
+    try {
+      parse("CREATE TABLE OUT (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert.assertEquals("Failure didn't match.",
+          "line 1:13 Failed to recognize predicate 'OUT'. Failed rule: 'identifier' in table name",
+          ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_OUTER() {
+    try {
+      parse("CREATE TABLE OUTER (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'OUTER'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_PARTITION() {
+    try {
+      parse("CREATE TABLE PARTITION (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'PARTITION'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_PERCENT() {
+    try {
+      parse("CREATE TABLE PERCENT (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'PERCENT'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_PROCEDURE() {
+    try {
+      parse("CREATE TABLE PROCEDURE (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'PROCEDURE'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_RANGE() {
+    try {
+      parse("CREATE TABLE RANGE (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'RANGE'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_READS() {
+    try {
+      parse("CREATE TABLE READS (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'READS'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_REVOKE() {
+    try {
+      parse("CREATE TABLE REVOKE (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'REVOKE'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_RIGHT() {
+    try {
+      parse("CREATE TABLE RIGHT (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'RIGHT'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_ROLLUP() {
+    try {
+      parse("CREATE TABLE ROLLUP (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'ROLLUP'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_ROW() {
+    try {
+      parse("CREATE TABLE ROW (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert.assertEquals("Failure didn't match.",
+          "line 1:13 Failed to recognize predicate 'ROW'. Failed rule: 'identifier' in table name",
+          ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_ROWS() {
+    try {
+      parse("CREATE TABLE ROWS (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'ROWS'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_SET() {
+    try {
+      parse("CREATE TABLE SET (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert.assertEquals("Failure didn't match.",
+          "line 1:13 Failed to recognize predicate 'SET'. Failed rule: 'identifier' in table name",
+          ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_SMALLINT() {
+    try {
+      parse("CREATE TABLE SMALLINT (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'SMALLINT'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_TABLE() {
+    try {
+      parse("CREATE TABLE TABLE (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'TABLE'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_TIMESTAMP() {
+    try {
+      parse("CREATE TABLE TIMESTAMP (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'TIMESTAMP'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_TO() {
+    try {
+      parse("CREATE TABLE TO (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert.assertEquals("Failure didn't match.",
+          "line 1:13 Failed to recognize predicate 'TO'. Failed rule: 'identifier' in table name",
+          ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_TRIGGER() {
+    try {
+      parse("CREATE TABLE TRIGGER (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'TRIGGER'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_TRUE() {
+    try {
+      parse("CREATE TABLE TRUE (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'TRUE'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_TRUNCATE() {
+    try {
+      parse("CREATE TABLE TRUNCATE (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'TRUNCATE'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_UNION() {
+    try {
+      parse("CREATE TABLE UNION (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'UNION'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_UPDATE() {
+    try {
+      parse("CREATE TABLE UPDATE (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'UPDATE'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_USER() {
+    try {
+      parse("CREATE TABLE USER (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'USER'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_USING() {
+    try {
+      parse("CREATE TABLE USING (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'USING'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_VALUES() {
+    try {
+      parse("CREATE TABLE VALUES (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'VALUES'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+
+  @Test
+  public void testSQL11ReservedKeyWords_WITH() {
+    try {
+      parse("CREATE TABLE WITH (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert
+          .assertEquals(
+              "Failure didn't match.",
+              "line 1:13 Failed to recognize predicate 'WITH'. Failed rule: 'identifier' in table name",
+              ex.getMessage());
+    }
+  }
+}