From 74fe235ab5ed169fb30d9d2c04077b90d1bf1b95 Mon Sep 17 00:00:00 2001
From: bomeng <bmeng@us.ibm.com>
Date: Tue, 19 Apr 2016 09:09:58 +0200
Subject: [PATCH] [SPARK-14398][SQL] Audit non-reserved keyword list in ANTLR4
 parser

## What changes were proposed in this pull request?

I have compared non-reserved list in Antlr3 and Antlr4 one by one as well as all the existing keywords defined in Antlr4, added the missing keywords to the non-reserved keywords list.  If we need to support more syntax, we can add more keywords by then.

Any recommendation for the above is welcome.

## How was this patch tested?

I manually checked the keywords one by one. Please let me know if there is a better way to test.

Another thought: I suggest to put all the keywords definition and non-reserved list in order, that will be much easier to check in the future.

Author: bomeng <bmeng@us.ibm.com>

Closes #12191 from bomeng/SPARK-14398.
---
 .../main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4  | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4 b/sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4
index 9cf2dd257e..6f104a1489 100644
--- a/sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4
+++ b/sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4
@@ -652,6 +652,7 @@ nonReserved
     | STATISTICS | ANALYZE | PARTITIONED | EXTERNAL | DEFINED | RECORDWRITER
     | REVOKE | GRANT | LOCK | UNLOCK | MSCK | REPAIR | EXPORT | IMPORT | LOAD | VALUES | COMMENT | ROLE
     | ROLES | COMPACTIONS | PRINCIPALS | TRANSACTIONS | INDEX | INDEXES | LOCKS | OPTION
+    | ASC | DESC | LIMIT | RENAME | SETS
     ;
 
 SELECT: 'SELECT';
-- 
GitLab