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;
|
|