[
https://issues.apache.org/jira/browse/HIVE-11335?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14636823#comment-14636823
]
fatkun commented on HIVE-11335:
-------------------------------
SEL[1] rowSchema tabAlias is null, this function
*ExprNodeDescUtils.indexOf(exprBack, reduceKeysBack)* return wrong. But I have
no idea change the code.
{code:title=SemanticAnalyzer.java}
private Operator genJoinReduceSinkChild(QB qb, ExprNodeDesc[] joinKeys,
Operator<?> child, String[] srcs, int tag) throws SemanticException {
...
// backtrack can be null when input is script operator
ExprNodeDesc exprBack = ExprNodeDescUtils.backtrack(expr, dummy, child);
int kindex = exprBack == null ? -1 : ExprNodeDescUtils.indexOf(exprBack,
reduceKeysBack);
if (kindex >= 0) {
ColumnInfo newColInfo = new ColumnInfo(colInfo);
newColInfo.setInternalName(Utilities.ReduceField.KEY + ".reducesinkkey"
+ kindex);
newColInfo.setTabAlias(nm[0]);
outputRR.addMappingOnly(nm[0], nm[1], newColInfo);
if (nm2 != null) {
outputRR.addMappingOnly(nm2[0], nm2[1], newColInfo);
}
index[i] = kindex;
continue;
}
...
}
{code}
> Multi-Join Inner Query producing incorrect results
> --------------------------------------------------
>
> Key: HIVE-11335
> URL: https://issues.apache.org/jira/browse/HIVE-11335
> Project: Hive
> Issue Type: Bug
> Components: Query Planning
> Affects Versions: 1.1.0
> Environment: CDH5.4.0
> Reporter: fatkun
> Attachments: query1.txt, query2.txt
>
>
> test step
> {code}
> create table log (uid string, uid2 string);
> insert into log values ('1', '1');
> create table user (uid string, name string);
> insert into user values ('1', "test1");
> {code}
> (Query1)
> {code}
> select b.name, c.name from log a
> left outer join (select uid, name from user) b on (a.uid=b.uid)
> left outer join user c on (a.uid2=c.uid);
> {code}
> return wrong result:
> 1 test1
> It should be both return test1
> (Query2)I try to find error, if I use this query, return right result.(join
> key different)
> {code}
> select b.name, c.name from log a
> left outer join (select uid, name from user) b on (a.uid=b.uid)
> left outer join user c on (a.uid=c.uid);
> {code}
> The explain is different,Query1 only select one colum. It should select uid
> and name.
> {code}
> b:user
> TableScan
> alias: user
> Statistics: Num rows: 1 Data size: 7 Basic stats: COMPLETE Column
> stats: NONE
> Select Operator
> expressions: uid (type: string)
> outputColumnNames: _col0
> {code}
> It may relate HIVE-10996
> =========UPDATE1===================
> (Query3) this query return correct result
> {code}
> select b.name, c.name from log a
> left outer join (select user.uid, user.name from user) b on (a.uid=b.uid)
> left outer join user c on (a.uid2=c.uid);
> {code}
> the operator tree
> TS[0]-SEL[1]-RS[5]-JOIN[6]-RS[7]-JOIN[9]-SEL[10]-FS[11]
> TS[2]-RS[4]-JOIN[6]
> TS[3]-RS[8]-JOIN[9]
> the Query1 SEL[1] rowSchema is wrong, cannot detect the tabAlias
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)