Reputation: 41
I am completely new to Hive. While creating a Hive table, I came across following error:
>create table coffee (WINDOW int);
Error: Error while compiling statement: FAILED: ParseException line 1:23
cannot recognize input near 'WINDOW' 'int' ')' in column specification
(state=42000,code=40000)
When I digged more, I realized its happening due to reserve keyword "Window" which I have used while creating table in Hive. Can I get a list of all reserve keyword in Hive which can not be used as a column name. I got a list of reserve keywords at following link, but I am able to use lot of listed reserve keywords as column name from it while creating table.
https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL
Upvotes: 1
Views: 4890
Reputation: 802
You can't use reserved keywords as column name. WINDOW is a reversed keyword. So use some other name for your variable.
Edit: use backtick quotation (``) like below:
create table coffee ( `WINDOW` int);
Upvotes: -1
Reputation: 7947
you can use backtick quotes to create tables/column with keyword names like this
create table coffee (`WINDOW` int);
Anyway, I would recommend choose a different name, if you want to select the data by column name, you will also must use the backtick quotes
Upvotes: 3