Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id E42AE200D5C for ; Fri, 1 Dec 2017 06:46:06 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id E298B160C04; Fri, 1 Dec 2017 05:46:06 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 0E132160C01 for ; Fri, 1 Dec 2017 06:46:05 +0100 (CET) Received: (qmail 19625 invoked by uid 500); 1 Dec 2017 05:46:05 -0000 Mailing-List: contact issues-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 issues@hive.apache.org Received: (qmail 19616 invoked by uid 99); 1 Dec 2017 05:46:05 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Dec 2017 05:46:05 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 571231A14F3 for ; Fri, 1 Dec 2017 05:46:04 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id wg2VeHEGulJS for ; Fri, 1 Dec 2017 05:46:02 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 6069F5FB76 for ; Fri, 1 Dec 2017 05:46:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 748CEE0732 for ; Fri, 1 Dec 2017 05:46:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 3261521065 for ; Fri, 1 Dec 2017 05:46:00 +0000 (UTC) Date: Fri, 1 Dec 2017 05:46:00 +0000 (UTC) From: "Pengcheng Xiong (JIRA)" To: issues@hive.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HIVE-18144) Runtime type inference error when join three table for different column type MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Fri, 01 Dec 2017 05:46:07 -0000 [ https://issues.apache.org/jira/browse/HIVE-18144?page=3Dcom.atlassian= .jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D1627= 3968#comment-16273968 ]=20 Pengcheng Xiong commented on HIVE-18144: ---------------------------------------- LGTM. I saw you put 2.1 and 2.2 as affected versions. How about master? > Runtime type inference error when join three table for different column t= ype=20 > -------------------------------------------------------------------------= ---- > > Key: HIVE-18144 > URL: https://issues.apache.org/jira/browse/HIVE-18144 > Project: Hive > Issue Type: Bug > Components: Query Planning > Affects Versions: 2.1.1, 2.2.0 > Reporter: Wang Haihua > Assignee: Wang Haihua > Attachments: HIVE-18144.1.patch > > > Union operation with three or more table, which has different column type= s, may cause type inference error when Task execution. > E.g, e.g. t1(with column int) union all t2(with column int) union all t3(= with column bigint), finally should be {{bigint}}, > RowSchema of union t1 with t2, we call {{leftOp}}, should be int, then le= ftOp union t3 should finally be bigint. > This mean RowSchema of leftOp would be {{bigint}} instead of {{int}} > However we see in {{SemanticAnalyzer.java}}, leftOp RowSchema is finally = {{int}} which was wrong:=20 > {code} > (_col0: int|{t01-subquery1}diff_long_type,_col1: int|{t01-subquery1}id2,_= col2: bigint|{t01-subquery1}id3)}} > {code} > Impacted code in SemanticAnalyzer.java: > {code} > if(!(leftOp instanceof UnionOperator)) { > Operator oldChild =3D leftOp; > leftOp =3D (Operator) leftOp.getParentOperators().get(0); > leftOp.removeChildAndAdoptItsChildren(oldChild); > } > // make left a child of right > List> child =3D > new ArrayList>(); > child.add(leftOp); > rightOp.setChildOperators(child); > List> parent =3D leftOp > .getParentOperators(); > parent.add(rightOp); > UnionDesc uDesc =3D ((UnionOperator) leftOp).getConf(); > // Here we should set RowSchema of leftOp to unionoutRR's, or else = the RowSchema of leftOp is wrong. > // leftOp.setSchema(new RowSchema(unionoutRR.getColumnInfos())); > uDesc.setNumInputs(uDesc.getNumInputs() + 1); > return putOpInsertMap(leftOp, unionoutRR); > {code} > Operation for reproduce=EF=BC=9A > {code} > create table test_union_different_type(id bigint, id2 bigint, id3 bigint,= name string); > set hive.auto.convert.join=3Dtrue; > insert overwrite table test_union_different_type select 1, 2, 3, "test_un= ion_different_type"; > select > t01.diff_long_type as diff_long_type, > t01.id2 as id2, > t00.id as id, > t01.id3 as id3 > from test_union_different_type t00 > left join > ( > select 1 as diff_long_type, 30 as id2, id3 from test_union_different_= type > union ALL > select 2 as diff_long_type, 20 as id2, id3 from test_union_different_= type > union ALL > select id as diff_long_type, id2, 30 as id3 from test_union_different= _type > ) t01 > on t00.id =3D t01.diff_long_type > ; > {code} > Stack trace: > {code} > Diagnostic Messages for this Task: > Error: java.lang.RuntimeException: org.apache.hadoop.hive.ql.metadata.Hiv= eException: Hive Runtime Error while processing row {"id":1,"id2":null,"id3= ":null,"name":null} > at org.apache.hadoop.hive.ql.exec.mr.ExecMapper.map(ExecMapper.java:169= ) > at org.apache.hadoop.mapred.MapRunner.run(MapRunner.java:54) > at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:453) > at org.apache.hadoop.mapred.MapTask.run(MapTask.java:343) > at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:164) > at java.security.AccessController.doPrivileged(Native Method) > at javax.security.auth.Subject.doAs(Subject.java:415) > at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInform= ation.java:1693) > at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158) > Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: Hive Runtime= Error while processing row {"id":1,"id2":null,"id3":null,"name":null} > at org.apache.hadoop.hive.ql.exec.MapOperator.process(MapOperator.java:= 499) > at org.apache.hadoop.hive.ql.exec.mr.ExecMapper.map(ExecMapper.java:160= ) > ... 8 more > Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: Unexpected e= xception from MapJoinOperator : org.apache.hadoop.io.LongWritable cannot be= cast to org.apache.hadoop.io.IntWritable > at org.apache.hadoop.hive.ql.exec.MapJoinOperator.process(MapJoinOperat= or.java:465) > at org.apache.hadoop.hive.ql.exec.Operator.forward(Operator.java:879) > at org.apache.hadoop.hive.ql.exec.TableScanOperator.process(TableScanOp= erator.java:130) > at org.apache.hadoop.hive.ql.exec.MapOperator$MapOpCtx.forward(MapOpera= tor.java:149) > at org.apache.hadoop.hive.ql.exec.MapOperator.process(MapOperator.java:= 489) > ... 9 more > Caused by: java.lang.ClassCastException: org.apache.hadoop.io.LongWritabl= e cannot be cast to org.apache.hadoop.io.IntWritable > at org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableIntO= bjectInspector.get(WritableIntObjectInspector.java:36) > at org.apache.hadoop.hive.serde2.lazy.LazyUtils.writePrimitiveUTF8(Lazy= Utils.java:239) > at org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe.serialize(LazySim= pleSerDe.java:292) > at org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe.serializeField(La= zySimpleSerDe.java:247) > at org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe.doSerialize(LazyS= impleSerDe.java:231) > at org.apache.hadoop.hive.serde2.AbstractEncodingAwareSerDe.serialize(A= bstractEncodingAwareSerDe.java:55) > at org.apache.hadoop.hive.ql.exec.FileSinkOperator.process(FileSinkOper= ator.java:714) > at org.apache.hadoop.hive.ql.exec.Operator.forward(Operator.java:879) > at org.apache.hadoop.hive.ql.exec.SelectOperator.process(SelectOperator= .java:95) > at org.apache.hadoop.hive.ql.exec.Operator.forward(Operator.java:879) > at org.apache.hadoop.hive.ql.exec.CommonJoinOperator.internalForward(Co= mmonJoinOperator.java:647) > at org.apache.hadoop.hive.ql.exec.CommonJoinOperator.genUniqueJoinObjec= t(CommonJoinOperator.java:660) > at org.apache.hadoop.hive.ql.exec.CommonJoinOperator.genUniqueJoinObjec= t(CommonJoinOperator.java:663) > at org.apache.hadoop.hive.ql.exec.CommonJoinOperator.checkAndGenObject(= CommonJoinOperator.java:759) > at org.apache.hadoop.hive.ql.exec.MapJoinOperator.process(MapJoinOperat= or.java:452) > ... 13 more > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)