Hive 从原始外部 table 插入覆盖动态分区外部 table 失败,出现空指针异常。,
Hive Insert overwrite into Dynamic partition external table from a raw external table failed with null pointer exception.,
我有一个包含四列的原始外部 table-
Table 1 :
create external table external_partitioned_rawtable
(age_bucket
String,country_destination String,gender
string,population_in_thousandsyear int)
row format delimited
fields terminated by '\t'
lines terminated by '\n' location
'/user/HadoopUser/hive'
我想要一个外部 table,分区来自 Country_destination 和 gender.Table -2
create external table external_partitioned
(age_bucket
String,population_in_thousandsyear int)
partitioned
by(country_destination String,gender String)
row format delimited
fields terminated by '\t'
lines terminated by '\n';
插入覆盖失败,出现空指针异常 -
insert overwrite table external_partitioned partition(country_destination,gender) <br>
select (age_bucket,population_in_thousandsyear,country_destination,gender) <br>
from external_partitioned_rawtable;
失败:NullPointerException 空
对于动态分区插入,在执行INSERT
语句之前你必须执行hive的两个属性:
set hive.exec.dynamic.partition=true;
set hive.exec.dynamic.partition.mode=nonstrict;
然后执行插入语句(我已经修改)
insert overwrite table external_partitioned partition(country_destination,gender)
select age_bucket,population_in_thousandsyear,country_destination,gender
from external_partitioned_rawtable;
希望对你有帮助!!!
我有一个包含四列的原始外部 table- Table 1 :
create external table external_partitioned_rawtable
(age_bucket String,country_destination String,gender string,population_in_thousandsyear int)
row format delimited fields terminated by '\t'
lines terminated by '\n' location '/user/HadoopUser/hive'
我想要一个外部 table,分区来自 Country_destination 和 gender.Table -2
create external table external_partitioned
(age_bucket String,population_in_thousandsyear int)
partitioned by(country_destination String,gender String)
row format delimited fields terminated by '\t'
lines terminated by '\n';
插入覆盖失败,出现空指针异常 -
insert overwrite table external_partitioned partition(country_destination,gender) <br>
select (age_bucket,population_in_thousandsyear,country_destination,gender) <br>
from external_partitioned_rawtable;
失败:NullPointerException 空
对于动态分区插入,在执行INSERT
语句之前你必须执行hive的两个属性:
set hive.exec.dynamic.partition=true;
set hive.exec.dynamic.partition.mode=nonstrict;
然后执行插入语句(我已经修改)
insert overwrite table external_partitioned partition(country_destination,gender)
select age_bucket,population_in_thousandsyear,country_destination,gender
from external_partitioned_rawtable;
希望对你有帮助!!!