Walter Wu created HIVE-15888:
--------------------------------

             Summary: PPD optimizer failed when query has the same alias with 
subquery
                 Key: HIVE-15888
                 URL: https://issues.apache.org/jira/browse/HIVE-15888
             Project: Hive
          Issue Type: Bug
          Components: Logical Optimizer
    Affects Versions: 1.2.1
            Reporter: Walter Wu


Example  :
select * 
from dpdim_employee_org_d c 
join 
(
select a.* from dpmid_md_organization a
left outer join dpmid_md_organization b 
on a.organizationid = b.superiororganizationid and b.hisdate = '2016-10-05'
where a.hisdate = '2016-09-05'
and b.organizationid is null 
) b 
on c.org_id = b.organizationid 
and c.hp_cal_dt = '2016-09-05' limit 10;

Description:
when ppd optimize is enabled this query has empty result . If we unenabled ppd 
optimize or we replace the subquery alias 'b' with 'b1' , this query will work 
correctly.
I explain this query and find that after ppd optimize Filter Operator predicate 
conf changed from 'predicate: superiororganizationid is not null (type: 
boolean)' to 'predicate: false (type: boolean)'.
The subquery has a filter predicate conf 'b.organizationid is 
null','b.organizationid' should equal to 'b:b.organizationid' . The outer query 
has a filter predicate conf 'b.organizationid is not null', 'b.organizationid' 
should equal to 'b:a.organizationid'. While rowSchema get Column Info on 
tabAlias:'b' and alias:'organizationid'. ppd optimize combine 'b.organizationid 
is not null' and  'b.organizationid is null' to 'constant false' . 



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to