Question

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.

Était-ce utile?

La 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

Autres conseils

Exchange is reserved keyword in Hive So try to use different keyword in place of that-

Create table Stocks (exchange1 String, stock_symbol String, stock_date String, stock_price_open double, stock_price_high double, stock_price_low do uble, stock_price_close double, stock_volume double, stock_price_adj_close double) row format delimited fields terminated by ",";

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top