Return-Path: X-Original-To: apmail-hive-dev-archive@www.apache.org Delivered-To: apmail-hive-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id AA8C510DE8 for ; Fri, 20 Dec 2013 01:50:07 +0000 (UTC) Received: (qmail 71941 invoked by uid 500); 20 Dec 2013 01:50:07 -0000 Delivered-To: apmail-hive-dev-archive@hive.apache.org Received: (qmail 71884 invoked by uid 500); 20 Dec 2013 01:50:07 -0000 Mailing-List: contact dev-help@hive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hive.apache.org Delivered-To: mailing list dev@hive.apache.org Received: (qmail 71876 invoked by uid 500); 20 Dec 2013 01:50:07 -0000 Delivered-To: apmail-hadoop-hive-dev@hadoop.apache.org Received: (qmail 71873 invoked by uid 99); 20 Dec 2013 01:50:07 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 20 Dec 2013 01:50:07 +0000 Date: Fri, 20 Dec 2013 01:50:07 +0000 (UTC) From: "Yin Huai (JIRA)" To: hive-dev@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HIVE-5891) Alias conflict when merging multiple mapjoin tasks into their common child mapred task MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HIVE-5891?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13853583#comment-13853583 ] Yin Huai commented on HIVE-5891: -------------------------------- i see. yes, seems getMapJoinContext and getSmbMapJoinContext can also have QBJoinTrees. I think it will be good to show meaningful aliases for those intermediate results. So, users can know where does an intermediate result come from. Since it is not easy to get the correct QB.id, I prefer to use QBJoinTree.id right now. Once this bug has been fixed, we can work on a followup jira to get rid of INTNAME. Also, I guess that we do not have an unit test to cover this bug. Can you add an test query in multiMapJoin2.q and comment the reason that we need this test? Thanks. > Alias conflict when merging multiple mapjoin tasks into their common child mapred task > -------------------------------------------------------------------------------------- > > Key: HIVE-5891 > URL: https://issues.apache.org/jira/browse/HIVE-5891 > Project: Hive > Issue Type: Bug > Components: Query Processor > Affects Versions: 0.12.0 > Reporter: Sun Rui > Assignee: Sun Rui > Attachments: HIVE-5891.1.patch > > > Use the following test case with HIVE 0.12: > {code:sql} > create table src(key int, value string); > load data local inpath 'src/data/files/kv1.txt' overwrite into table src; > select * from ( > select c.key from > (select a.key from src a join src b on a.key=b.key group by a.key) tmp > join src c on tmp.key=c.key > union all > select c.key from > (select a.key from src a join src b on a.key=b.key group by a.key) tmp > join src c on tmp.key=c.key > ) x; > {code} > We will get a NullPointerException from Union Operator: > {noformat} > java.lang.RuntimeException: org.apache.hadoop.hive.ql.metadata.HiveException: Hive Runtime Error while processing row {"_col0":0} > at org.apache.hadoop.hive.ql.exec.mr.ExecMapper.map(ExecMapper.java:175) > at org.apache.hadoop.mapred.MapRunner.run(MapRunner.java:50) > at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:436) > at org.apache.hadoop.mapred.MapTask.run(MapTask.java:372) > at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:212) > Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: Hive Runtime Error while processing row {"_col0":0} > at org.apache.hadoop.hive.ql.exec.MapOperator.process(MapOperator.java:544) > at org.apache.hadoop.hive.ql.exec.mr.ExecMapper.map(ExecMapper.java:157) > ... 4 more > Caused by: java.lang.NullPointerException > at org.apache.hadoop.hive.ql.exec.UnionOperator.processOp(UnionOperator.java:120) > at org.apache.hadoop.hive.ql.exec.Operator.process(Operator.java:504) > at org.apache.hadoop.hive.ql.exec.Operator.forward(Operator.java:842) > at org.apache.hadoop.hive.ql.exec.SelectOperator.processOp(SelectOperator.java:88) > at org.apache.hadoop.hive.ql.exec.Operator.process(Operator.java:504) > at org.apache.hadoop.hive.ql.exec.Operator.forward(Operator.java:842) > at org.apache.hadoop.hive.ql.exec.CommonJoinOperator.genUniqueJoinObject(CommonJoinOperator.java:652) > at org.apache.hadoop.hive.ql.exec.CommonJoinOperator.genUniqueJoinObject(CommonJoinOperator.java:655) > at org.apache.hadoop.hive.ql.exec.CommonJoinOperator.checkAndGenObject(CommonJoinOperator.java:758) > at org.apache.hadoop.hive.ql.exec.MapJoinOperator.processOp(MapJoinOperator.java:220) > at org.apache.hadoop.hive.ql.exec.Operator.process(Operator.java:504) > at org.apache.hadoop.hive.ql.exec.Operator.forward(Operator.java:842) > at org.apache.hadoop.hive.ql.exec.TableScanOperator.processOp(TableScanOperator.java:91) > at org.apache.hadoop.hive.ql.exec.Operator.process(Operator.java:504) > at org.apache.hadoop.hive.ql.exec.Operator.forward(Operator.java:842) > at org.apache.hadoop.hive.ql.exec.MapOperator.process(MapOperator.java:534) > ... 5 more > {noformat} > > The root cause is in CommonJoinTaskDispatcher.mergeMapJoinTaskIntoItsChildMapRedTask(). > {noformat} > +--------------+ +--------------+ > | MapJoin task | | MapJoin task | > +--------------+ +--------------+ > \ / > \ / > +--------------+ > | Union task | > +--------------+ > {noformat} > CommonJoinTaskDispatcher merges the two MapJoin tasks into their common child: Union task. The two MapJoin tasks have the same alias name for their big tables: $INTNAME, which is the name of the temporary table of a join stream. The aliasToWork map uses alias as key, so eventually only the MapJoin operator tree of one MapJoin task is saved into the aliasToWork map of the Union task, while the MapJoin operator tree of another MapJoin task is lost. As a result, Union operator won't be initialized because not all of its parents gets intialized (The Union operator itself indicates it has two parents, but actually it has only 1 parent because another parent is lost). > This issue does not exist in HIVE 0.11 and thus is a regression bug in HIVE 0.12. > The propsed solution is to use the query ID as prefix for the join stream name to avoid conflict and add sanity check code in CommonJoinTaskDispatcher that merge of a MapJoin task into its child MapRed task is skipped if there is any alias conflict. Please review the patch. I am not sure if the patch properly handles the case of DemuxOperator. > BTW, anyone knows the origin of "$INTNAME"? it is so confusing, maybe we can replace it with a meaningful name. -- This message was sent by Atlassian JIRA (v6.1.4#6159)