FAILED: ParseException: cannot recognize input near 'exchange' 'string' ',' in column specification

Brisi picture Brisi · Jan 12, 2015 · Viewed 13.1k times · Source

I am using latest AWS Hive version 0.13.0.

FAILED: ParseException: cannot recognize input near 'exchange' 'string' ',' in column specification

I am getting the above error when I run the below(create table) query.

CREATE EXTERNAL TABLE test ( 
foo string, 
exchange string,
bar string) ROW FORMAT DELIMITED
FIELDS TERMINATED BY '\t' 
LINES TERMINATED BY '\n' 
STORED AS TEXTFILE
LOCATION '/home/hadoop/test/';

If I rename the exchange like 'xch' it creates table successfully. Any reason?

Answer

Ashrith picture Ashrith · Jan 12, 2015

You are getting an error because exchange is a keyword used to move the data in a partition from a table to another table that has the same schema but does not already have that partition for details view Hive Language Manual and HIVE-4095.