Return-Path: X-Original-To: apmail-hive-commits-archive@www.apache.org Delivered-To: apmail-hive-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E530C18CBD for ; Tue, 11 Aug 2015 23:40:38 +0000 (UTC) Received: (qmail 93591 invoked by uid 500); 11 Aug 2015 23:40:38 -0000 Delivered-To: apmail-hive-commits-archive@hive.apache.org Received: (qmail 93544 invoked by uid 500); 11 Aug 2015 23:40:38 -0000 Mailing-List: contact commits-help@hive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hive-dev@hive.apache.org Delivered-To: mailing list commits@hive.apache.org Received: (qmail 93533 invoked by uid 99); 11 Aug 2015 23:40:38 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Aug 2015 23:40:38 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 878E9E0A9E; Tue, 11 Aug 2015 23:40:38 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: pxiong@apache.org To: commits@hive.apache.org Message-Id: <4aaafc613f7f4d99b5c9a222372aa7e4@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: hive git commit: HIVE-8926:: Projections that only swap input columns are identified incorrectly as identity projections (Jesus via Ashutosh Chauhan) Date: Tue, 11 Aug 2015 23:40:38 +0000 (UTC) Repository: hive Updated Branches: refs/heads/branch-1.0 d3919332a -> fbcef73cc HIVE-8926:: Projections that only swap input columns are identified incorrectly as identity projections (Jesus via Ashutosh Chauhan) Project: http://git-wip-us.apache.org/repos/asf/hive/repo Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/fbcef73c Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/fbcef73c Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/fbcef73c Branch: refs/heads/branch-1.0 Commit: fbcef73ccd0ff740329d5ecaa94c57ad20212a0f Parents: d391933 Author: Ashutosh Chauhan Authored: Sun Nov 23 06:32:09 2014 +0000 Committer: Pengcheng Xiong Committed: Tue Aug 11 16:40:14 2015 -0700 ---------------------------------------------------------------------- .../hadoop/hive/ql/exec/SelectOperator.java | 52 +++++++++++++++++--- 1 file changed, 46 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hive/blob/fbcef73c/ql/src/java/org/apache/hadoop/hive/ql/exec/SelectOperator.java ---------------------------------------------------------------------- diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/SelectOperator.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/SelectOperator.java index 95d2d76..93017d3 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/exec/SelectOperator.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/SelectOperator.java @@ -24,6 +24,7 @@ import java.util.List; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hive.conf.HiveConf; import org.apache.hadoop.hive.ql.metadata.HiveException; +import org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc; import org.apache.hadoop.hive.ql.plan.ExprNodeDesc; import org.apache.hadoop.hive.ql.plan.SelectDesc; import org.apache.hadoop.hive.ql.plan.api.OperatorType; @@ -133,22 +134,61 @@ public class SelectOperator extends Operator implements Serializable * @return if it is an identity select operator or not */ public boolean isIdentitySelect() { - //Safety check + // Safety check if(this.getNumParent() != 1) { return false; } - //Select * - if(this.getConf().isSelStarNoCompute() || - this.getConf().isSelectStar()) { + if(conf.isSelStarNoCompute()) { return true; } - //Check whether the have the same schema - if(!OperatorUtils.sameRowSchema(this, this.getParentOperators().get(0))) { + // Check whether the have the same schema + RowSchema orig = this.getSchema(); + RowSchema dest = this.getParentOperators().get(0).getSchema(); + if(orig.getSignature() == null && dest.getSignature() == null) { + return true; + } + if((orig.getSignature() == null && dest.getSignature() != null) || + (orig.getSignature() != null && dest.getSignature() == null) ) { + return false; + } + + if(orig.getSignature().size() != dest.getSignature().size() || + orig.getSignature().size() != conf.getColList().size()) { return false; } + for(int i=0; i