create table as select建表后数据和原查询语句结果不一致

Viewed 110

使用create table test as select * from ( select tt.tag_name, tt.tag_id, d.tag_id_unt as dp_tag_id_unt from ( select 'oneip_explode' as tag_name, tag_id_cf as tag_id, count(1) as tag_id_unt, 3593758 as crowd_unt, tag_unt, 1 as confid_sum from di_dwb.tmp_zhy_0820_1 group by tag_id_cf, tag_unt ) tt left join (select * from di_dwb.dwb_par_multi_tag_user_portrait_wd d where d.pt_w='3000-12-31') d on tt.tag_name = d.tag_name and tt.tag_id = d.tag_id ) t1;
建立新表test后,
select
count(1)
from
(
select
tt.tag_name,
tt.tag_id,
d.tag_id_unt as dp_tag_id_unt
from
(
select
'oneip_explode' as tag_name,
tag_id_cf as tag_id,
count(1) as tag_id_unt,
3593758 as crowd_unt,
tag_unt,
1 as confid_sum
from
di_dwb.tmp_zhy_0820_1
group by
tag_id_cf,
tag_unt
) tt
left join (select * from di_dwb.dwb_par_multi_tag_user_portrait_wd d where d.pt_w='3000-12-31') d
on tt.tag_name = d.tag_name
and tt.tag_id = d.tag_id
) t1 where dp_tag_id_unt is null;

select count(1) from di_dwb.test where dp_tag_id_unt is null;
结果不一致,dp_tag_id_unt列null值变多了很多,想请问下这是什么原因

版本2.0.11

2 Answers

这个case这么不太好分析。
要不这么测试下:

  1. 新建一张test 表,insert into select 拉一下数据
  2. 对比下test和select查询的总行数

如果有不一致的情况,打开这个开关再试一下:set enable_nereids_dml = true; 然后相同session下执行下试试

enable_nereids_dml不打开的情况下 数据出错,请问下后续这个问题社区有考虑修复嘛