您的位置:首页 > 其它

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

2018-03-12 11:53 633 查看
[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> 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐