分享

Hive中查出来的结果和mysql中查出来的结果不一致

CrayonCool 发表于 2017-11-10 13:28:27 [显示全部楼层] 回帖奖励 阅读模式 关闭右栏 2 5254
Hive中查出来的结果和mysql中查出来的结果不一致
标准sql查出来2432条数据,HQL在Hive中查出来5287条数据,这个问题要怎么解决啊?

标准sql:
select rule.rule_number as "rule_num",
product.name  as "product_type",
org.name as "organization",
dcode.code as "refuse_loan_cod_num",
dcode.name as "refuse_loan_code_desc",
IFNULL(sum(case when result.result_state = 1 and result.touched = "Y" then 1 end), 0) as "hit_num",
Date(SUBSTRING_INDEX(result.de_inserttime        ," ", 1)) as "load_date",
now() as "data_date"
from de_rule_result result
left join de_rule rule on result.r_id = rule.r_id
left join de_data_denied_code dcode on rule.denied_loans_code = dcode.code
left join flow_apply apply on result.apply_id = apply.apply_id
left join de_data_product product on product.product_id = apply.product_id
left join de_organization org on org.id = rule.department_id
group by dcode.code,rule.`name`,SUBSTRING_INDEX(result.de_inserttime," ", 1);

HQL:
select rule.rule_number as rule_num,
product.name as product_type,org.name as organization,
dcode.code as refuse_loan_cod_num,
coalesce(sum(case when result.result_state = 1 and result.touched = "Y" then 1 end), 0) as hit_num,
to_date(result.de_inserttime) as load_date,
dcode.name as s
from de_rule_result result
left outer join de_rule rule on result.r_id = rule.r_id
left outer join de_data_denied_code dcode on rule.denied_loans_code = dcode.code
left outer join flow_apply apply on result.apply_id = apply.apply_id
left outer join de_data_product product on product.product_id = apply.product_id
left outer join de_organization org on org.id = rule.department_id
group by rule.rule_number,product.name,org.name,dcode.code,to_date(result.de_inserttime),dcode.name;



已有(2)人评论

跳转到指定楼层
CrayonCool 发表于 2017-11-10 14:03:39
已解决,关联的字段中存在null值的情况
回复

使用道具 举报

YTP520YTP 发表于 2017-11-20 14:48:18
CrayonCool 发表于 2017-11-10 14:03
已解决,关联的字段中存在null值的情况
我也是这个问题
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条