You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by px...@apache.org on 2016/10/12 21:04:18 UTC
[2/2] hive git commit: HIVE-14872: Remove the configuration
HIVE_SUPPORT_SQL11_RESERVED_KEYWORDS (Pengcheng Xiong,
reviewed by Ashutosh Chauhan)
HIVE-14872: Remove the configuration HIVE_SUPPORT_SQL11_RESERVED_KEYWORDS (Pengcheng Xiong, reviewed by Ashutosh Chauhan)
Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/9cfdd4bb
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/9cfdd4bb
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/9cfdd4bb
Branch: refs/heads/master
Commit: 9cfdd4bb0c63ac487094692caac2a66d4831f973
Parents: bfa34f3
Author: Pengcheng Xiong <px...@apache.org>
Authored: Wed Oct 12 14:04:03 2016 -0700
Committer: Pengcheng Xiong <px...@apache.org>
Committed: Wed Oct 12 14:04:03 2016 -0700
----------------------------------------------------------------------
.../org/apache/hadoop/hive/conf/HiveConf.java | 4 -
.../hadoop/hive/ql/parse/FromClauseParser.g | 3 -
.../apache/hadoop/hive/ql/parse/HiveParser.g | 10 +-
.../hadoop/hive/ql/parse/IdentifiersParser.g | 48 +-
.../hadoop/hive/ql/parse/SelectClauseParser.g | 3 -
.../TestSQL11ReservedKeyWordsNegative.java | 2158 +++++++++---------
.../TestSQL11ReservedKeyWordsPositive.java | 822 -------
ql/src/test/queries/clientpositive/keyword_2.q | 7 +-
.../queries/clientpositive/ppd_field_garbage.q | 6 +-
.../queries/clientpositive/udaf_collect_set_2.q | 34 +-
.../authorization_cannot_create_all_role.q.out | 2 +-
.../authorization_cannot_create_none_role.q.out | 2 +-
.../clientnegative/cte_with_in_subquery.q.out | 2 +-
.../clientnegative/lateral_view_join.q.out | 2 +-
.../results/clientnegative/subq_insert.q.out | 2 +-
.../test/results/clientpositive/keyword_2.q.out | 12 +-
.../llap/udaf_collect_set_2.q.out | 64 +-
.../clientpositive/ppd_field_garbage.q.out | 14 +-
.../clientpositive/udaf_collect_set_2.q.out | 64 +-
.../compiler/errors/missing_overwrite.q.out | 2 +-
20 files changed, 1207 insertions(+), 2054 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/9cfdd4bb/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
----------------------------------------------------------------------
diff --git a/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java b/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
index 5ea9751..e6ca361 100644
--- a/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
+++ b/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
@@ -2678,9 +2678,6 @@ public class HiveConf extends Configuration {
" 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."),
HIVE_SUPPORT_SPECICAL_CHARACTERS_IN_TABLE_NAMES("hive.support.special.characters.tablename", true,
"This flag should be set to true to enable support for special characters in table names.\n"
+ "When it is set to false, only [a-zA-Z_0-9]+ are supported.\n"
@@ -3977,7 +3974,6 @@ public class HiveConf extends Configuration {
ConfVars.HIVE_SCHEMA_EVOLUTION.varname,
ConfVars.HIVE_SERVER2_LOGGING_OPERATION_LEVEL.varname,
ConfVars.HIVE_SERVER2_THRIFT_RESULTSET_SERIALIZE_IN_TASKS.varname,
- ConfVars.HIVE_SUPPORT_SQL11_RESERVED_KEYWORDS.varname,
ConfVars.HIVE_SUPPORT_SPECICAL_CHARACTERS_IN_TABLE_NAMES.varname,
ConfVars.JOB_DEBUG_CAPTURE_STACKTRACES.varname,
ConfVars.JOB_DEBUG_TIMEOUT.varname,
http://git-wip-us.apache.org/repos/asf/hive/blob/9cfdd4bb/ql/src/java/org/apache/hadoop/hive/ql/parse/FromClauseParser.g
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/FromClauseParser.g b/ql/src/java/org/apache/hadoop/hive/ql/parse/FromClauseParser.g
index bf35d60..26aca96 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/FromClauseParser.g
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/FromClauseParser.g
@@ -35,9 +35,6 @@ k=3;
RecognitionException e) {
gParent.errors.add(new ParseError(gParent, e, tokenNames));
}
- protected boolean useSQL11ReservedKeywordsForIdentifier() {
- return gParent.useSQL11ReservedKeywordsForIdentifier();
- }
}
@rulecatch {
http://git-wip-us.apache.org/repos/asf/hive/blob/9cfdd4bb/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g b/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g
index bef3acf..5c16c55 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g
@@ -690,12 +690,6 @@ import org.apache.hadoop.hive.conf.HiveConf;
public void setHiveConf(Configuration hiveConf) {
this.hiveConf = hiveConf;
}
- protected boolean useSQL11ReservedKeywordsForIdentifier() {
- if(hiveConf==null){
- return false;
- }
- return !HiveConf.getBoolVar(hiveConf, HiveConf.ConfVars.HIVE_SUPPORT_SQL11_RESERVED_KEYWORDS);
- }
}
@rulecatch {
@@ -2514,11 +2508,11 @@ body
whereClause?
groupByClause?
havingClause?
+ window_clause?
orderByClause?
clusterByClause?
distributeByClause?
sortByClause?
- window_clause?
limitClause? -> ^(TOK_INSERT insertClause
selectClause lateralView? whereClause? groupByClause? havingClause? orderByClause? clusterByClause?
distributeByClause? sortByClause? window_clause? limitClause?)
@@ -2528,11 +2522,11 @@ body
whereClause?
groupByClause?
havingClause?
+ window_clause?
orderByClause?
clusterByClause?
distributeByClause?
sortByClause?
- window_clause?
limitClause? -> ^(TOK_INSERT ^(TOK_DESTINATION ^(TOK_DIR TOK_TMP_FILE))
selectClause lateralView? whereClause? groupByClause? havingClause? orderByClause? clusterByClause?
distributeByClause? sortByClause? window_clause? limitClause?)
http://git-wip-us.apache.org/repos/asf/hive/blob/9cfdd4bb/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g b/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g
index 6ae731f..50987c3 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g
@@ -35,9 +35,6 @@ k=3;
RecognitionException e) {
gParent.errors.add(new ParseError(gParent, e, tokenNames));
}
- protected boolean useSQL11ReservedKeywordsForIdentifier() {
- return gParent.useSQL11ReservedKeywordsForIdentifier();
- }
}
@rulecatch {
@@ -206,7 +203,7 @@ functionName
|
(functionIdentifier) => functionIdentifier
|
- {!useSQL11ReservedKeywordsForIdentifier()}? sql11ReservedKeywordsUsedAsCastFunctionName -> Identifier[$sql11ReservedKeywordsUsedAsCastFunctionName.start]
+ sql11ReservedKeywordsUsedAsFunctionName -> Identifier[$sql11ReservedKeywordsUsedAsFunctionName.start]
;
castExpression
@@ -663,9 +660,6 @@ identifier
:
Identifier
| nonReserved -> Identifier[$nonReserved.start]
- // 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.start]
;
functionIdentifier
@@ -684,11 +678,13 @@ principalIdentifier
| QuotedIdentifier
;
-//The new version of nonReserved + sql11ReservedKeywordsUsedAsIdentifier = old version of nonReserved
-//Non reserved keywords are basically the keywords that can be used as identifiers.
-//All the KW_* are automatically not only keywords, but also reserved keywords.
-//That means, they can NOT be used as identifiers.
-//If you would like to use them as identifiers, put them in the nonReserved list below.
+// Here is what you have to do if you would like to add a new keyword.
+// Note that non reserved keywords are basically the keywords that can be used as identifiers.
+// (1) Add a new entry to HiveLexer, e.g., KW_TRUE : 'TRUE';
+// (2) If it is reserved, you do NOT need to change IdentifiersParser.g
+// because all the KW_* are automatically not only keywords, but also reserved keywords.
+// However, you need to add a test to TestSQL11ReservedKeyWordsNegative.java.
+// Otherwise it is non-reserved, you need to put them in the nonReserved list below.
//If you are not sure, please refer to the SQL2011 column in
//http://www.postgresql.org/docs/9.5/static/sql-keywords-appendix.html
nonReserved
@@ -725,30 +721,8 @@ nonReserved
| KW_KEY
;
-//The following SQL2011 reserved keywords are used as cast function name only, but not as identifiers.
-sql11ReservedKeywordsUsedAsCastFunctionName
+//The following SQL2011 reserved keywords are used as function name only, but not as identifiers.
+sql11ReservedKeywordsUsedAsFunctionName
:
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.
-//We are planning to remove the following whole list after several releases.
-//Thus, please do not change the following list unless you know what to do.
-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
-//The following two keywords come from MySQL. Although they are not keywords in SQL2011, they are reserved keywords in MySQL.
- | KW_REGEXP | KW_RLIKE
- | KW_PRIMARY
- | KW_FOREIGN
- | KW_CONSTRAINT
- | KW_REFERENCES
- | KW_PRECISION
- ;
+ ;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hive/blob/9cfdd4bb/ql/src/java/org/apache/hadoop/hive/ql/parse/SelectClauseParser.g
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/SelectClauseParser.g b/ql/src/java/org/apache/hadoop/hive/ql/parse/SelectClauseParser.g
index 5f06ff4..3c6fa39 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/SelectClauseParser.g
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/SelectClauseParser.g
@@ -35,9 +35,6 @@ k=3;
RecognitionException e) {
gParent.errors.add(new ParseError(gParent, e, tokenNames));
}
- protected boolean useSQL11ReservedKeywordsForIdentifier() {
- return gParent.useSQL11ReservedKeywordsForIdentifier();
- }
}
@rulecatch {
http://git-wip-us.apache.org/repos/asf/hive/blob/9cfdd4bb/ql/src/test/org/apache/hadoop/hive/ql/parse/TestSQL11ReservedKeyWordsNegative.java
----------------------------------------------------------------------
diff --git a/ql/src/test/org/apache/hadoop/hive/ql/parse/TestSQL11ReservedKeyWordsNegative.java b/ql/src/test/org/apache/hadoop/hive/ql/parse/TestSQL11ReservedKeyWordsNegative.java
index 97ae0d9..a427803 100644
--- a/ql/src/test/org/apache/hadoop/hive/ql/parse/TestSQL11ReservedKeyWordsNegative.java
+++ b/ql/src/test/org/apache/hadoop/hive/ql/parse/TestSQL11ReservedKeyWordsNegative.java
@@ -30,1074 +30,1098 @@ import org.junit.Test;
/**
* Parser tests for SQL11 Reserved KeyWords. Please find more information in
- * HIVE-6617. Total number : 74 + 2 (MySQL)
+ * HIVE-6617. Total number : 81
+ * ALL,ALTER,ARRAY,AS,AUTHORIZATION,BETWEEN,BIGINT,BINARY
+ * ,BOOLEAN,BOTH,BY,CONSTRAINT
+ * ,CREATE,CUBE,CURRENT_DATE,CURRENT_TIMESTAMP,CURSOR,
+ * DATE,DECIMAL,DELETE,DESCRIBE
+ * ,DOUBLE,DROP,EXISTS,EXTERNAL,FALSE,FETCH,FLOAT,FOR
+ * ,FOREIGN,FULL,GRANT,GROUP,GROUPING
+ * ,IMPORT,IN,INNER,INSERT,INT,INTERSECT,INTO,IS
+ * ,LATERAL,LEFT,LIKE,LOCAL,NONE,NULL
+ * ,OF,ORDER,OUT,OUTER,PARTITION,PERCENT,PRECISION
+ * ,PRIMARY,PROCEDURE,RANGE,READS,
+ * REFERENCES,REGEXP,REVOKE,RIGHT,RLIKE,ROLLUP,ROW
+ * ,ROWS,SET,SMALLINT,TABLE,TIMESTAMP
+ * ,TO,TRIGGER,TRUE,TRUNCATE,UNION,UPDATE,USER,USING,VALUES,WITH,
*/
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());
- }
- }
-
- // MySQL reserved keywords.
- @Test
- public void testSQL11ReservedKeyWords_RLIKE() {
- try {
- parse("CREATE TABLE RLIKE (col STRING)");
- Assert.assertFalse("Expected ParseException", true);
- } catch (ParseException ex) {
- Assert
- .assertEquals(
- "Failure didn't match.",
- "line 1:13 Failed to recognize predicate 'RLIKE'. Failed rule: 'identifier' in table name",
- ex.getMessage());
- }
- }
-
- @Test
- public void testSQL11ReservedKeyWords_REGEXP() {
- try {
- parse("CREATE TABLE REGEXP (col STRING)");
- Assert.assertFalse("Expected ParseException", true);
- } catch (ParseException ex) {
- Assert
- .assertEquals(
- "Failure didn't match.",
- "line 1:13 Failed to recognize predicate 'REGEXP'. Failed rule: 'identifier' in table name",
- ex.getMessage());
- }
- }
+ private static HiveConf conf;
+
+ private ParseDriver pd;
+
+ @BeforeClass
+ public static void initialize() {
+ conf = new HiveConf(SemanticAnalyzer.class);
+ 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 cannot recognize input near 'ALL' '(' 'col' 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 cannot recognize input near 'ALTER' '(' 'col' 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 cannot recognize input near 'ARRAY' '(' 'col' 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 cannot recognize input near 'AS' '(' 'col' 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 cannot recognize input near 'AUTHORIZATION' '(' 'col' 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 cannot recognize input near 'BETWEEN' '(' 'col' 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 cannot recognize input near 'BIGINT' '(' 'col' 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 cannot recognize input near 'BINARY' '(' 'col' 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 cannot recognize input near 'BOOLEAN' '(' 'col' 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 cannot recognize input near 'BOTH' '(' 'col' 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 cannot recognize input near 'BY' '(' 'col' in table name",
+ ex.getMessage());
+ }
+ }
+
+ @Test
+ public void testSQL11ReservedKeyWords_CONSTRAINT() {
+ try {
+ parse("CREATE TABLE CONSTRAINT (col STRING)");
+ Assert.assertFalse("Expected ParseException", true);
+ } catch (ParseException ex) {
+ Assert.assertEquals(
+ "Failure didn't match.",
+ "line 1:13 cannot recognize input near 'CONSTRAINT' '(' 'col' 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 cannot recognize input near 'CREATE' '(' 'col' 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 cannot recognize input near 'CUBE' '(' 'col' 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 cannot recognize input near 'CURRENT_DATE' '(' 'col' 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 cannot recognize input near 'CURRENT_TIMESTAMP' '(' 'col' 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 cannot recognize input near 'CURSOR' '(' 'col' 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 cannot recognize input near 'DATE' '(' 'col' 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 cannot recognize input near 'DECIMAL' '(' 'col' 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 cannot recognize input near 'DELETE' '(' 'col' 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 cannot recognize input near 'DESCRIBE' '(' 'col' 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 cannot recognize input near 'DOUBLE' '(' 'col' 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 cannot recognize input near 'DROP' '(' 'col' 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 cannot recognize input near 'EXISTS' '(' 'col' 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 cannot recognize input near 'EXTERNAL' '(' 'col' 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 cannot recognize input near 'FALSE' '(' 'col' 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 cannot recognize input near 'FETCH' '(' 'col' 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 cannot recognize input near 'FLOAT' '(' 'col' 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 cannot recognize input near 'FOR' '(' 'col' in table name",
+ ex.getMessage());
+ }
+ }
+
+ @Test
+ public void testSQL11ReservedKeyWords_FOREIGN() {
+ try {
+ parse("CREATE TABLE FOREIGN (col STRING)");
+ Assert.assertFalse("Expected ParseException", true);
+ } catch (ParseException ex) {
+ Assert.assertEquals(
+ "Failure didn't match.",
+ "line 1:13 cannot recognize input near 'FOREIGN' '(' 'col' 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 cannot recognize input near 'FULL' '(' 'col' 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 cannot recognize input near 'GRANT' '(' 'col' 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 cannot recognize input near 'GROUP' '(' 'col' 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 cannot recognize input near 'GROUPING' '(' 'col' 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 cannot recognize input near 'IMPORT' '(' 'col' 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 cannot recognize input near 'IN' '(' 'col' 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 cannot recognize input near 'INNER' '(' 'col' 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 cannot recognize input near 'INSERT' '(' 'col' 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 cannot recognize input near 'INT' '(' 'col' 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 cannot recognize input near 'INTERSECT' '(' 'col' 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 cannot recognize input near 'INTO' '(' 'col' 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 cannot recognize input near 'IS' '(' 'col' 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 cannot recognize input near 'LATERAL' '(' 'col' 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 cannot recognize input near 'LEFT' '(' 'col' 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 cannot recognize input near 'LIKE' '(' 'col' 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 cannot recognize input near 'LOCAL' '(' 'col' 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 cannot recognize input near 'NONE' '(' 'col' 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 cannot recognize input near 'NULL' '(' 'col' 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 cannot recognize input near 'OF' '(' 'col' 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 cannot recognize input near 'ORDER' '(' 'col' 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 cannot recognize input near 'OUT' '(' 'col' 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 cannot recognize input near 'OUTER' '(' 'col' 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 cannot recognize input near 'PARTITION' '(' 'col' 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 cannot recognize input near 'PERCENT' '(' 'col' in table name",
+ ex.getMessage());
+ }
+ }
+
+ @Test
+ public void testSQL11ReservedKeyWords_PRECISION() {
+ try {
+ parse("CREATE TABLE PRECISION (col STRING)");
+ Assert.assertFalse("Expected ParseException", true);
+ } catch (ParseException ex) {
+ Assert.assertEquals(
+ "Failure didn't match.",
+ "line 1:13 cannot recognize input near 'PRECISION' '(' 'col' in table name",
+ ex.getMessage());
+ }
+ }
+
+ @Test
+ public void testSQL11ReservedKeyWords_PRIMARY() {
+ try {
+ parse("CREATE TABLE PRIMARY (col STRING)");
+ Assert.assertFalse("Expected ParseException", true);
+ } catch (ParseException ex) {
+ Assert.assertEquals(
+ "Failure didn't match.",
+ "line 1:13 cannot recognize input near 'PRIMARY' '(' 'col' 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 cannot recognize input near 'PROCEDURE' '(' 'col' 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 cannot recognize input near 'RANGE' '(' 'col' 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 cannot recognize input near 'READS' '(' 'col' in table name",
+ ex.getMessage());
+ }
+ }
+
+ @Test
+ public void testSQL11ReservedKeyWords_REFERENCES() {
+ try {
+ parse("CREATE TABLE REFERENCES (col STRING)");
+ Assert.assertFalse("Expected ParseException", true);
+ } catch (ParseException ex) {
+ Assert.assertEquals(
+ "Failure didn't match.",
+ "line 1:13 cannot recognize input near 'REFERENCES' '(' 'col' in table name",
+ ex.getMessage());
+ }
+ }
+
+ @Test
+ public void testSQL11ReservedKeyWords_REGEXP() {
+ try {
+ parse("CREATE TABLE REGEXP (col STRING)");
+ Assert.assertFalse("Expected ParseException", true);
+ } catch (ParseException ex) {
+ Assert.assertEquals(
+ "Failure didn't match.",
+ "line 1:13 cannot recognize input near 'REGEXP' '(' 'col' 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 cannot recognize input near 'REVOKE' '(' 'col' 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 cannot recognize input near 'RIGHT' '(' 'col' in table name",
+ ex.getMessage());
+ }
+ }
+
+ @Test
+ public void testSQL11ReservedKeyWords_RLIKE() {
+ try {
+ parse("CREATE TABLE RLIKE (col STRING)");
+ Assert.assertFalse("Expected ParseException", true);
+ } catch (ParseException ex) {
+ Assert.assertEquals(
+ "Failure didn't match.",
+ "line 1:13 cannot recognize input near 'RLIKE' '(' 'col' 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 cannot recognize input near 'ROLLUP' '(' 'col' 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 cannot recognize input near 'ROW' '(' 'col' 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 cannot recognize input near 'ROWS' '(' 'col' 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 cannot recognize input near 'SET' '(' 'col' 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 cannot recognize input near 'SMALLINT' '(' 'col' 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 cannot recognize input near 'TABLE' '(' 'col' 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 cannot recognize input near 'TIMESTAMP' '(' 'col' 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 cannot recognize input near 'TO' '(' 'col' 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 cannot recognize input near 'TRIGGER' '(' 'col' 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 cannot recognize input near 'TRUE' '(' 'col' 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 cannot recognize input near 'TRUNCATE' '(' 'col' 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 cannot recognize input near 'UNION' '(' 'col' 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 cannot recognize input near 'UPDATE' '(' 'col' 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 cannot recognize input near 'USER' '(' 'col' 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 cannot recognize input near 'USING' '(' 'col' 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 cannot recognize input near 'VALUES' '(' 'col' 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 cannot recognize input near 'WITH' '(' 'col' in table name",
+ ex.getMessage());
+ }
+ }
}