问题描述
我创建了一个 Hive 表,它从文本文件加载数据.但是它在所有查询上返回空结果集.
I created a Hive Table, which loads data from a text file. But its returning empty result set on all queries.
我尝试了以下命令:
命令被执行,表被创建.但是,对于所有查询总是返回 0 行,包括 SELECT * FROM table2;
The command gets executed, and the table gets created. But, always returns 0 rows for all queries, including SELECT * FROM table2;
示例数据:
单行输入数据:
1|155190|7706|1|17|21168.23|0.04|0.02|N|O|1996-03-13|1996-02-12|1996-03-22|亲自送货|卡车|上述普通球场|
1|155190|7706|1|17|21168.23|0.04|0.02|N|O|1996-03-13|1996-02-12|1996-03-22|DELIVER IN PERSON|TRUCK|egular courts above the|
我附上了数据文件的屏幕截图.命令的输出:DESCRIBE FORMATTED table2;
I have attached the screen shot of the data file. Output for command: DESCRIBE FORMATTED table2;
+-----------------------------------------------------------------------------------------------------------------+
+-----------------------------------------------------------------------------------------------------------------+
谢谢!
推荐答案
请确保位置 /user/biadmin/lineitem.txt 确实存在并且您在那里有数据.由于您使用的是 LOCATION 子句,因此您的数据必须存在于那里,而不是默认仓库位置 /user/hive/warehouse.
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.
快速ls验证:
另外,请确保您使用了正确的分隔符.
Also, make sure that you are using the proper delimiter.
这篇关于Hive 表在所有查询上返回空结果集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!