gpt4 book ai didi

hadoop - Hive 从原始外部表向动态分区外部表插入覆盖失败,出现空指针异常。

转载 作者:可可西里 更新时间:2023-11-01 14:36:45 24 4
gpt4 key购买 nike

我有一个包含四列的原始外部表-表 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'

我想要一个包含 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 null

最佳答案

对于动态分区插入,在执行 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;

希望对你有帮助!!!

关于hadoop - Hive 从原始外部表向动态分区外部表插入覆盖失败,出现空指针异常。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37560774/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com