Search code examples
hiveexternal

Parse error while creating External Table


I am new to Hadoop. I am trying to create an EXTERNAL table in Hive.

The following is the query I am using:

CREATE EXTERNAL TABLE stocks (
exchange STRING,
symbol STRING,
ymd STRING,
price_open FLOAT,
price_high FLOAT,
price_low FLOAT,
price_close FLOAT,
volume INT,
price_adj_close FLOAT
)
ROW FORMAT DELIMITED FIELDS TERMINATED BY ','
LOCATION 'hdfs:///data/stocks'

I am getting an error:

' ParseException cannot recognize input near 'exchange' 'STRING' ',' in column specification.

What am I missing? I tried reading the command - I don't think I am missing anything.


Solution

  • Because exchange is a keyword in hive, so you can't use exchange to be your column name. If you want to use it just add backticks around exchange