0
votes

I have loaded the data into hive table from the notepad, it is showing data is copied but when i run the select query it is showing null, please let us know what could be the reason

hive> create table test_sq(k string, v string) stored as sequencefile;

hive> load data local inpath '/tmp/input.txt' into table test_sq; OK

hive> select * from tesst_t; OK NULL NULL NULL NULL

2

2 Answers

0
votes

Notepad : Assuming it is text. Whereas you have specified it as sequencefile.

Your create table script should be:

create table test_sq(k string, v string) row format delimited fields terminated by '';

0
votes

I m not sure, if it is just a typo but you are trying to query on other table (tesst_t) instead of table that you loaded (test_sq)

Can you provide a sample line from your text file.

If you are using tab as delimiter then you can just use create table test_sq(k string, v string); .In other cases , as venkat has mentioned , use create table test_sq(k string, v string) row format delimited fields terminated by 'single_character_delimiter' . This will work even with tab delimiter('\t').