蜂巢中的字符串与double进行比较时发生了什么

时间:2019-06-19 12:08:42

标签: hive hiveql

我编写了一个配置单元脚本来进行一些分析,结果出乎意料。经过一番尝试,我发现原因是因为double和""之间的比较。为了比较,我编写了以下脚本:

select get_json_object(expparams, '$.CTR') as pv_exp_id,
               cast(poiCtr as double) / 1000000.0 as poiCtr,
               pvid,
               dt
          from  pv_log LATERAL VIEW explode(split(ctr, '\073'))r as poiCtr
         where dt>=20190612
           and dt<=20190612
           and poiCtr <>""    
           limit 100
select * from (
select get_json_object(expparams, '$.CTR') as pv_exp_id,
               cast(poiCtr as double) / 1000000.0 as poiCtr,
               pvid,
               dt
          from pv_log LATERAL VIEW explode(split(ctr, '\073'))r as poiCtr
         where dt>=20190612
           and dt<=20190612         
           and poiCtr <> "" 
           limit 100
  ) a where poiCtr <> ""

第一个脚本输出预期的记录。但是第二个脚本什么也没做。

那么当我在外层比较poiCtr和""时为什么过滤所有记录?我在网上搜索后发现几乎没有帮助。

谢谢!

0 个答案:

没有答案