Hive建表时报错 FAILED: ParseException line 2:0 character ' ' not supported here

在hiva中建表时

hive (gmall)> create external table ods_user_info( 
            >     `id` string COMMENT '用户id',
            >     `name`  string COMMENT '姓名',
            >     `birthday` string COMMENT '生日',
            >     `gender` string COMMENT '性别',
            >     `email` string COMMENT '邮箱',
            >     `user_level` string COMMENT '用户等级',
            >     `create_time` string COMMENT '创建时间'
            > ) COMMENT '用户信息'
            > PARTITIONED BY (`dt` string)
            > row format delimited fields terminated by '\t'
            > location '/warehouse/gmall/ods/ods_user_info/'
            > ;

FAILED: ParseException line 2:0 character ' ' not supported here
line 3:0 character ' ' not supported here
line 4:0 character ' ' not supported here
line 4:1 character ' ' not supported here
line 5:0 character ' ' not supported here
line 5:1 character ' ' not supported here
line 5:2 character ' ' not supported here
line 6:0 character ' ' not supported here
line 6:1 character ' ' not supported here
line 6:2 character ' ' not supported here
line 7:0 character ' ' not supported here
line 7:1 character ' ' not supported here
line 7:2 character ' ' not supported here
line 8:0 character ' ' not supported here
line 8:1 character ' ' not supported here
line 8:2 character ' ' not supported here

只要将 建表语句中的多余空格删除即可,可能是因为空格在hive中转译时出现问题。

快速删除多余的空格的方法:将代码粘贴到NotePad++

alter+shift 鼠标左键选择多行,直接删除即可完成多行一并删除。

hive (gmall)> create external table ods_user_info( 
            > `id` string COMMENT '用户id',
            > `name`  string COMMENT '姓名',
            > `birthday` string COMMENT '生日',
            > `gender` string COMMENT '性别',
            > `email` string COMMENT '邮箱',
            > `user_level` string COMMENT '用户等级',
            > `create_time` string COMMENT '创建时间'
            > ) COMMENT '用户信息'
            > PARTITIONED BY (`dt` string)
            > row format delimited fields terminated by '\t'
            > location '/warehouse/gmall/ods/ods_user_info/'
            > ;
OK
Time taken: 0.707 seconds

猜你喜欢

转载自blog.csdn.net/qq_45648512/article/details/106064387