mia
mia

Reputation: 83

Hive create external table

I'm trying to create the table in the hive but am getting the below-mentioned error. Can anyone help me what is the issue?

CREATE EXTERNAL TABLE IF NOT EXISTS flightInfo2008
(Year INT,
Month INT,
DayofMonth INT,
DayOfWeek INT,
DepTime INT,
CRSDepTime INT,
ArrTime INT,
CRSArrTime INT,
UniqueCarrier STRING,
FlightNum INT,
TailNum STRING,
ActualElapsedTime INT,
CRSElapsedTime INT,
AirTime INT,
ArrDelay INT,
DepDelay INT,
Origin  STRING,
Dest STRING,
Distance INT,
TaxiIn INT,
TaxiOut INT,
Cancelled INT,
CancellationCode INT,
Diverted INT,
CarrierDelay INT,
WeatherDelay INT,
NASDelay INT,
SecurityDelay INT,
LateAircraftDelay INT)
COMMENT 'mydb flightInfo2008'
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ';'
STORED AS TEXTFILE 
LOCATION '/user/hadoop/mydata';

FAILED: ParseException line 15:10 cannot recognize input near ',' 'ArrDelay' 'INT' in column type
hive>

Upvotes: 0

Views: 1681

Answers (2)

Nikolay Smirnov
Nikolay Smirnov

Reputation: 36

Running your CREATE statement from hive:

FAILED: ParseException line 33:22 mismatched input '' expecting StringLiteral near 'BY' in table row format's field separator

From beeline:

Error: Error while compiling statement: FAILED: ParseException line 33:22 mismatched input '' expecting StringLiteral near 'BY' in table row format's field separator (state=42000,code=40000)

In both cases the problem is with

FIELDS TERMINATED BY ';'

which should be written as

FIELDS TERMINATED BY '\;'

After this modification I created the table both from hive and beeline.

Impala-shell accepts both ';' and '\;' and creates the table successfully.

But your error message is not the same as my ones. So I agree with already given answers that apparently the problem is with invisible special character(s) near ArrDelay.

Upvotes: 0

Ankita A.
Ankita A.

Reputation: 1

Look for some special character that might be added while copying the text from a notepad.

Upvotes: 0

Related Questions