Author: gunther
Date: Sat Sep 20 01:20:26 2014
New Revision: 1626377

URL: http://svn.apache.org/r1626377
Log:
HIVE-8198: [CBO] Handle case where top level schema contains repeated alias 
(Ashutosh Chauhan via Gunther Hagleitner)

Modified:
    
hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/optiq/translator/DerivedTableInjector.java

Modified: 
hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/optiq/translator/DerivedTableInjector.java
URL: 
http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/optiq/translator/DerivedTableInjector.java?rev=1626377&r1=1626376&r2=1626377&view=diff
==============================================================================
--- 
hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/optiq/translator/DerivedTableInjector.java
 (original)
+++ 
hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/optiq/translator/DerivedTableInjector.java
 Sat Sep 20 01:20:26 2014
@@ -138,7 +138,12 @@ public class DerivedTableInjector {
     // (limit)?(OB)?(ProjectRelBase)....
     List<RexNode> rootChildExps = originalProjRel.getChildExps();
     if (resultSchema.size() != rootChildExps.size()) {
-      throw new RuntimeException("Result Schema didn't match Optiq Optimized 
Op Tree Schema");
+      // this is a bug in Hive where for queries like select key,value,value
+      // convertRowSchemaToResultSetSchema() only returns schema containing 
key,value
+      // Underlying issue is much deeper because it seems like RowResolver 
itself doesnt have
+      // those mappings. see limit_pushdown.q & limit_pushdown_negative.q
+      // Till Hive issue is fixed, disable CBO for such queries.
+      throw new OptiqSemanticException("Result Schema didn't match Optiq 
Optimized Op Tree Schema");
     }
 
     List<String> newSelAliases = new ArrayList<String>();


Reply via email to