[
https://issues.apache.org/jira/browse/HIVE-8667?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14190916#comment-14190916
]
Sergey Shelukhin commented on HIVE-8667:
----------------------------------------
Simplest query I found that reproes is:
{noformat}
select src.key from src left outer join srcpart on src.key = srcpart.key where
false;
{noformat}
The reason seems to be that CBO pushes filter thru join, and nullscan optimizer
no longer sees it.
Original plan is
{noformat}
HiveProjectRel(key=[$0])
HiveFilterRel(condition=[false])
HiveJoinRel(condition=[=($0, $5)], joinType=[left])
HiveTableScanRel(table=[[default.src]])
HiveTableScanRel(table=[[default.srcpart]])
{noformat}
After PPD it becomes
{noformat}
HiveProjectRel(key=[$0])
HiveJoinRel(condition=[=($0, $1)], joinType=[left])
HiveProjectRel(key=[$0])
HiveFilterRel(condition=[false])
HiveTableScanRel(table=[[default.src]])
HiveProjectRel(key=[$0])
HiveTableScanRel(table=[[default.srcpart]])
{noformat}
and final plan is
{noformat}
HiveProjectRel(src.key=[$0])
HiveProjectRel(key=[$1], key0=[$0])
HiveJoinRel(condition=[=($1, $0)], joinType=[right])
HiveProjectRel(key=[$0])
HiveTableScanRel(table=[[default.srcpart]])
HiveProjectRel(key=[$0])
HiveFilterRel(condition=[false])
HiveTableScanRel(table=[[default.src]])
{noformat}
(as an unrelated side note, I wonder why CBO changes left joins to right joins,
and the other way around, in all the queries)
Not sure if there's a good fix for this. We can also make nullscan optimizer
aware of joins? Don't push false filters?
It's probably useless for any real query though, so we can just ignore this.
> CBO: optimize_nullscan - some TableScans for nullscans appeared after CBO
> -------------------------------------------------------------------------
>
> Key: HIVE-8667
> URL: https://issues.apache.org/jira/browse/HIVE-8667
> Project: Hive
> Issue Type: Sub-task
> Components: CBO
> Reporter: Sergey Shelukhin
> Assignee: Sergey Shelukhin
> Fix For: 0.15.0
>
>
> Looks like some rewriting by CBO prevents nullscans from being optimized.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)