Reputation: 107
I have a raw external table with four columns- 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'
I want a external table with partitions from Country_destination and 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 is failing with null pointer exception-
insert overwrite table external_partitioned partition(country_destination,gender) <br>
select (age_bucket,population_in_thousandsyear,country_destination,gender) <br>
from external_partitioned_rawtable;
FAILED: NullPointerException null
Upvotes: 4
Views: 2548
Reputation: 3766
For dynamic partition insertion, before executing the INSERT
statement you have to execute two properties of hive:
set hive.exec.dynamic.partition=true;
set hive.exec.dynamic.partition.mode=nonstrict;
then execute insert statement(which I have modified)
insert overwrite table external_partitioned partition(country_destination,gender)
select age_bucket,population_in_thousandsyear,country_destination,gender
from external_partitioned_rawtable;
I hope this help you!!!
Upvotes: 2