Hive 表在所有查询上返回空结果集

Hive Table returning empty result set on all queries(Hive 表在所有查询上返回空结果集)
本文介绍了Hive 表在所有查询上返回空结果集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个 Hive 表,它从文本文件加载数据.但是它在所有查询上返回空结果集.

I created a Hive Table, which loads data from a text file. But its returning empty result set on all queries.

我尝试了以下命令:

CREATE TABLE table2(
id1 INT,
id2 INT,
id3 INT,
id4 STRING,
id5 INT,
id6 STRING,
id7 STRING,
id8 STRING,
id9 STRING,
id10 STRING,
id11 STRING,
id12 STRING,
id13 STRING,
id14 STRING,
id15 STRING
)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '|'
STORED AS TEXTFILE
LOCATION '/user/biadmin/lineitem';

命令被执行,表被创建.但是,对于所有查询总是返回 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;

| Wed Apr 16 20:18:58 IST 2014 : Connection obtained for host: big-instght-15.persistent.co.in, port number 1528. |
| # col_name                    data_type                   comment                                               |
|                                                                                                                 |
| id1                         int                         None                                                    |
| id2                         int                         None                                                    |
| id3                         int                         None                                                    |
| id4                         string                      None                                                    |
| id5                         int                         None                                                    |
| id6                         string                      None                                                    |
| id7                         string                      None                                                    |
| id8                         string                      None                                                    |
| id9                         string                      None                                                    |
| id10                        string                      None                                                    |
| id11                        string                      None                                                    |
| id12                        string                      None                                                    |
| id13                        string                      None                                                    |
| id14                        string                      None                                                    |
| id15                        string                      None                                                    |
|                                                                                                                 |
| # Detailed Table Information                                                                                    |
| Database:                   default                                                                             |
| Owner:                      biadmin                                                                             |
| CreateTime:                 Mon Apr 14 20:17:31 IST 2014                                                        |
| LastAccessTime:             UNKNOWN                                                                             |
| Protect Mode:               None                                                                                |
| Retention:                  0                                                                                   |
| Location:                   hdfs://big-instght-11.persistent.co.in:9000/user/biadmin/lineitem                 |
| Table Type:                 MANAGED_TABLE                                                                       |
| Table Parameters:                                                                                               |
|         serialization.null.format                                                                               |
|         transient_lastDdlTime        1397486851                                                                 |
|                                                                                                                 |
| # Storage Information                                                                                           |
| SerDe Library:              org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe                                  |
| InputFormat:                org.apache.hadoop.mapred.TextInputFormat                                            |
| OutputFormat:               org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat                          |
| Compressed:                 No                                                                                  |
| Num Buckets:                -1                                                                                  |
| Bucket Columns:             []                                                                                  |
| Sort Columns:               []                                                                                  |
| Storage Desc Params:                                                                                            |
|         field.delim                 |                                                                          |

+-----------------------------------------------------------------------------------------------------------------+

+-----------------------------------------------------------------------------------------------------------------+

谢谢!

推荐答案

请确保位置 /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验证:

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

另外,请确保您使用了正确的分隔符.

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

这篇关于Hive 表在所有查询上返回空结果集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Execute complex raw SQL query in EF6(在EF6中执行复杂的原始SQL查询)
Hibernate reactive No Vert.x context active in aws rds(AWS RDS中的休眠反应性非Vert.x上下文处于活动状态)
Bulk insert with mysql2 and NodeJs throws 500(使用mysql2和NodeJS的大容量插入抛出500)
Flask + PyMySQL giving error no attribute #39;settimeout#39;(FlASK+PyMySQL给出错误,没有属性#39;setTimeout#39;)
auto_increment column for a group of rows?(一组行的AUTO_INCREMENT列?)
Sort by ID DESC(按ID代码排序)