hive的一个bug?

select count(1)  
from (
       select case when data_type = '15'
 then '1' else '0' end as ssss
       from woa_login_android where  version_type = 0 and data_type in ('15','30') and pt = '2012-07-03'
) a 
where a.ssss = '1' 

这个结果集是有记录的,子查询的case when 后面只有一个条件,在外面用where过滤是没问题的,

如果在子查询中的case when 后面有两个以上的条件语句,那么在子查询外面用where条件过滤时候就有问题。

select count(1)  
from (
       select case when data_type = '15' or data_type = '30'
 then '1' else '0' end as ssss
       from woa_login_android where  version_type = 0 and data_type in ('15','30') and pt = '2012-07-03'
) a 
where a.ssss = '1' 

而如果单独执行这个子查询,里面case when后面跟多个条件也是没问题的。。

不知道大家是否遇到这种情况??

猜你喜欢

转载自superlxw1234.iteye.com/blog/1577236