Hive Table returning empty result set on all queries

我只是一个虾纸丫 提交于 2019-12-01 14:28:10

Please make sure that the location /user/biadmin/lineitem.txt actually exists and you have data present there. Since you are using LOCATION clause your data must be present there, instead of the default warehouse location, /user/hive/warehouse.

Do a quick ls to verify that :

bin/hadoop fs -ls /user/biadmin/lineitem.txt

Also, make sure that you are using the proper delimiter.

Did you tried with LOAD DATA LOCAL INFILE

LOAD DATA LOCAL INFILE'/user/biadmin/lineitem.txt' INTO TABLE table2 
FIELDS TERMINATED BY '|'
LINES TERMINATED BY '\n'
(id1,id2,id3........);

Documentation: http://dev.mysql.com/doc/refman/5.1/en/load-data.html

Are you using managed table or external table?? If it is external table you should use external keyword while creating the table. after creating the table load data into the table using load command. if it is managed table, after loading data to the table, you could see the data in your hive warehouse directory in hadoop. the default path is "/user/hive/warehouse/yourtablename". you should run the load command in the hive shell.

I was able to load the data to the table. The problem was:

LOCATION '/user/biadmin/lineitem';

wasn't loading any data. But when I gave the directory containing the file as the path like:

LOCATION '/user/biadmin/tpc-h';

where I put the lineite.txt file in the tpc-h directory.

It worked!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!