You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ha...@apache.org on 2014/09/16 01:24:32 UTC

svn commit: r1625184 - /hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java

Author: hashutosh
Date: Mon Sep 15 23:24:32 2014
New Revision: 1625184

URL: http://svn.apache.org/r1625184
Log:
HIVE-8108 : [CBO] Handle queries without any source tables (Ashutosh Chauhan via John Pullokkaran)

Modified:
    hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java

Modified: hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java?rev=1625184&r1=1625183&r2=1625184&view=diff
==============================================================================
--- hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java (original)
+++ hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java Mon Sep 15 23:24:32 2014
@@ -13862,6 +13862,22 @@ public class SemanticAnalyzer extends Ba
         aliasToRel.put(tableAlias, op);
       }
 
+
+      if (aliasToRel.isEmpty()) {
+        //// This may happen for queries like select 1; (no source table)
+        // We can do following which is same, as what Hive does.
+        // With this, we will be able to generate Optiq plan.
+        //        qb.getMetaData().setSrcForAlias(DUMMY_TABLE, getDummyTable());
+        //        RelNode op =  genTableLogicalPlan(DUMMY_TABLE, qb);
+        //        qb.addAlias(DUMMY_TABLE);
+        //        qb.setTabAlias(DUMMY_TABLE, DUMMY_TABLE);
+        //        aliasToRel.put(DUMMY_TABLE, op);
+        // However, Hive trips later while trying to get Metadata for this dummy table
+        // So, for now lets just disable this. Anyway there is nothing much to
+        // optimize in such cases.
+        throw new OptiqSemanticException("Unsupported");
+
+      }
       // 1.3 process join
       if (qb.getParseInfo().getJoinExpr() != null) {
         srcRel = genJoinLogicalPlan(qb.getParseInfo().getJoinExpr(), aliasToRel);