文件数据的格式问题hive解析出现错误

[wangshumin@centoshostnameKL2 ~]$ hdfs dfs -put  stu2 /user/hive/warehouse/hive2_db1.db/stu2
[wangshumin@centoshostnameKL2 ~]$ hdfs dfs -cat /user/hive/warehouse/hive2_db1.db/stu2/stu2
1 ,zhangshan ,20
2 ,wangwu  ,  19
3 ,xiaolu  ,  26
[wangshumin@centoshostnameKL2 ~]$ vim stu2
[wangshumin@centoshostnameKL2 ~]$ cp stu2  stu3
[wangshumin@centoshostnameKL2 ~]$ vim stu3
[wangshumin@centoshostnameKL2 ~]$ hdfs dfs -put  stu3 /user/hive/warehouse/hive2_db1.db/stu3
^[[A[wangshumin@centoshostnameKL2 ~]$ hdfs dfs -cat /user/hive/warehouse/hive2_db1.db/stu3/stu3
1 , zhangshan , 20
2 , wangwu  , 19
3 , xiaolu  , 26
[wangshumin@centoshostnameKL2 ~]$ cat stu1
1 ,zhangshan ,20
2 ,wangwu  ,  19
3 ,xiaolu  ,  26
[wangshumin@centoshostnameKL2 ~]$ cat stu2
1 ,zhangshan ,20
2 ,wangwu  ,  19
3 ,xiaolu  ,  26
[wangshumin@centoshostnameKL2 ~]$ cat stu3
1 , zhangshan , 20
2 , wangwu  , 19
3 , xiaolu  , 26

[wangshumin@centoshostnameKL2 ~]$ 





hive> create  table  stu1( id int , name  String , age  int ) 
    > row format delimited 
    > fields terminated by ' ' ;
OK
Time taken: 0.073 seconds
hive> select  * from  stu1;
OK
1 zhangshan 20
2 wangwu NULL
3 xiaolu NULL
Time taken: 0.078 seconds, Fetched: 3 row(s)
hive> select  * from  stu1;
OK
1 zhangshan 20
2 wangwu NULL
3 xiaolu NULL
Time taken: 0.074 seconds, Fetched: 3 row(s)
hive> select  * from  stu1;
OK
1 zhangshan 20
2 wangwu NULL
3 xiaolu NULL
Time taken: 0.073 seconds, Fetched: 3 row(s)
hive> select  * from  stu1;
OK
1 zhangshan 20
2 wangwu NULL
3 xiaolu NULL
Time taken: 0.113 seconds, Fetched: 3 row(s)
hive> create  table  stu1( id int , name  String , age  int ) 
    > row format delimited 
    > fields terminated by ',' ;
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. AlreadyExistsException(message:Table stu1 already exists)
hive> create  table  stu2( id int , name  String , age  int ) 
    > row format delimited 
    > fields terminated by ',' ;
OK
Time taken: 0.083 seconds
hive> select  * from  stu2;
OK
NULL zhangshan 20
NULL wangwu   NULL
NULL xiaolu   NULL
Time taken: 0.419 seconds, Fetched: 3 row(s)
hive> create  table  stu2( id int , name  String , age  int ) 
    > row format delimited 
    > fields terminated by ',' ;
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. AlreadyExistsException(message:Table stu2 already exists)
hive> create  table  stu3( id int , name  String , age  int ) 
    > row format delimited 
    > fields terminated by ',' ;
OK
Time taken: 0.073 seconds
hive> select  *  from  stu3 ;
OK
NULL zhangshan NULL
NULL wangwu   NULL
NULL xiaolu   NULL
Time taken: 0.069 seconds, Fetched: 3 row(s)
hive> 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值