hive查询表,返回结果是null
2024-08-31 20:15:57
问题:hive查询表,返回结果都是null
hive> create table testTable(id int, name string);
hive> load data local inpath '/home/test.txt' into table testTable;
其中“/home/test.txt”的内容为下面所示,每一行的(id,name)之间使用一个空格分割。
1 tom
2 lili
hive> select * from users;
OK
NULL NULL
NULL NULL
解决办法:
hive> create table testTable(id int, name string);
改为:
hive> CREATE TABLE testTable(id int, name string) ROW FORMAT DELIMITED FIELDS TERMINATED BY ' ' LINES TERMINATED BY '\n' STORED AS TEXTFILE;
其中TERMINATED BY ' '指定了数据分隔符是一个空格,与“/home/test.txt”中每行分隔符一致。
hive> select * from new_test;
OK
1 tom
2 lili
综上所述:hive 中创建表加载数据的时候,分隔符与加载文件中的分隔符需要一致,才能得到正确的查询结果.
最新文章
- 第二天--html
- mysql 怎么查询出,分组后的总条数。。。也就是有多少组数。。。。怎么写
- centos6.5安装mysql记录
- [Javascript] Promise-based functions should not throw exceptions
- 关于 iOS10 更新后 360 云盘 的上传按钮消失的解决方案
- C#中 ? 和?? 的用法
- javaweb学习总结十一(JAXP对XML文档进行DOM解析)
- oracle的function和procedure返回值给shell
- 关于Adobe Flash 11.3 引起的火狐使用问题
- angularJS环境安装
- Java凝视Annotation
- nginx参数的详细说明
- python开发之virtualenv与virtualenvwrapper讲解
- 7I - 数塔
- Django聚合与分组查询中value与annotate的顺序问题
- F800上的CPU有多少个core?
- python金融与量化分析------Matplotlib(绘图和可视化)
- Linux 双网卡配置两个IP同时只有一个会通的原因
- Java虚拟机--虚拟机字节码执行引擎
- ASP.Net中关于WebAPI与Ajax进行跨域数据交互时Cookies数据的传递
热门文章
- PHP经常使用正則表達式汇总
- mac使用git管理Github
- linux 自启动
- svn Couldn't open rep-cache database
- connect()
- eclipse + MinGW调试程序printf输出被buffer的问题
- oracle怎么卸载
- Web里URL空格的转换方法
- ASP.NET动态网站制作(25)-- ADO.NET(4)
- Error:“const char*”类型的实参与“wchar_t”类型的形参不兼容