If you have partition table and you want to add new column in table then after adding the new column using ALTER command the value appears NULL in that column then that case you should use CASCADE clause at end of ALTER command.
alter table pos_all_flgs_dh3 add columns(dheeren2 string) CASCADE;
INSERT
INTO pos_all_flgs_dh3 partition
(
Region_Code,
Partner_Tier_Indicator_Code,
Fiscal_Year_Week_Code
)
SELECT DISTINCT
p1.Channel_Sub_Segment_Identifier,
p1.Source_File_Name,
if((p1.cross_source_sale_flag <> p2.cross_source_sale_flag),'dheerentest','dheerentest') as dheeren2,
p1.Region_Code,
p1.Partner_Tier_Indicator_Code,
p1.Fiscal_Year_Week_Code
FROM
pos_4_flg_dh p1 LEFT OUTER JOIN pos_2_flg_dh p2
ON p1.Partner_Sales_Transaction_Identifier= p2.Partner_Sales_Transaction_Identifier limit 1;
alter table pos_all_flgs_dh3 add columns(dheeren2 string) CASCADE;
INSERT
INTO pos_all_flgs_dh3 partition
(
Region_Code,
Partner_Tier_Indicator_Code,
Fiscal_Year_Week_Code
)
SELECT DISTINCT
p1.Channel_Sub_Segment_Identifier,
p1.Source_File_Name,
if((p1.cross_source_sale_flag <> p2.cross_source_sale_flag),'dheerentest','dheerentest') as dheeren2,
p1.Region_Code,
p1.Partner_Tier_Indicator_Code,
p1.Fiscal_Year_Week_Code
FROM
pos_4_flg_dh p1 LEFT OUTER JOIN pos_2_flg_dh p2
ON p1.Partner_Sales_Transaction_Identifier= p2.Partner_Sales_Transaction_Identifier limit 1;