# 创建分桶表 hive (mydb)> create table if not exists course( > id int, > name string, > score int > ) > clustered by (id) into 3 buckets > row format delimited > fields terminated by '\t'; # 加载数据 hive (mydb)> load data local inpath '/root/data/hive_data/course.dat' into table course; FAILED: SemanticException Please load into an intermediate table and use 'insert... select' to allow Hive to enforce bucketing. Load into bucketed tables are disabled for safety reasons. If you know what you are doing, please sethive.strict.checks.bucketing to false and that hive.mapred.mode is not set to 'strict' to proceed. Note that if you may get errors or incorrect results if you make a mistake while using some of the unsafe features. # 说明不能使用给普通表加载数据的方式给分桶表加载数据,方法如下: # 先创建结构相同的普通表 hive (mydb)> create table if not exists course_common( > id int, > name string, > score int > ) > row format delimited > fields terminated by '\t'; # 给普通表加载数据 hive (mydb)> load data local inpath '/root/data/hive_data/course.dat' into table course_common; # 使用insert ... into ...select hive (mydb)> insert into table course select * from course_common;
FAILED: SemanticException Please load into an intermediate table and use ‘insert... select‘ to allow
最新推荐文章于 2024-02-25 14:16:39 发布