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 dabe2a8d1cdf6a3b57a3fb34a9791a824e6b22e7..0e18a1acd0d33f4e76004981471e35fd0ee338aa 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 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,16 +134,60 @@ public boolean acceptLimitPushdown() { * @return if it is an identity select operator or not */ public boolean isIdentitySelect() { - //Safety check + // Safety check if(this.getNumParent() != 1) { return false; } + + if(this.isSelectStarNoCompute) { + return true; + } + + // 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; + } - //Check whether the have the same schema - if(!OperatorUtils.sameRowSchema(this, this.getParentOperators().get(0))) { + if(orig.getSignature().size() != dest.getSignature().size()) { return false; } + for(int i=0; i