文件数据的格式问题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
1zhangshan20
2wangwuNULL
3xiaoluNULL
Time taken: 0.078 seconds, Fetched: 3 row(s)
hive> select  * from  stu1;
OK
1zhangshan20
2wangwuNULL
3xiaoluNULL
Time taken: 0.074 seconds, Fetched: 3 row(s)
hive> select  * from  stu1;
OK
1zhangshan20
2wangwuNULL
3xiaoluNULL
Time taken: 0.073 seconds, Fetched: 3 row(s)
hive> select  * from  stu1;
OK
1zhangshan20
2wangwuNULL
3xiaoluNULL
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
NULLzhangshan 20
NULLwangwu  NULL
NULLxiaolu  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> 


版权声明:本文为wangshuminjava原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。