aks
aks

Reputation: 11

external table in Hive not showing data

I created a table in Hive

create external table if not exists firsttest 
(id int, 
name char(50), 
exp char(50))

row format delimited FIELDS TERMINATED BY '/t'

stored as textfile
location '/user/amit/test1'

The file on test1 location is a simple .txt file with 3 rows tab delimited as below

1   kiran    oracle

2   das      oracle

3   rahul    python

the external table get created. However when I do select * from firsttest then I see 3 rows will all NULL data. Can anyone explain why? why I see all null values and no data.

Thanks. Aks

Upvotes: 1

Views: 745

Answers (1)

notNull
notNull

Reputation: 31490

Fields terminated by delimiter has to be \t instead of /t.

Drop the existing table and recreate table with correct delimiter and then try to select the data from the table.

Example:

drop table firsttest;
create external table if not exists firsttest 
(id int, 
name char(50), 
exp char(50))
row format delimited FIELDS TERMINATED BY '\t'
stored as textfile;

Upvotes: 2

Related Questions