You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by zs...@apache.org on 2008/12/09 23:48:35 UTC

svn commit: r724923 - in /hadoop/hive/trunk: ./ ql/src/java/org/apache/hadoop/hive/ql/parse/ ql/src/test/queries/clientnegative/ ql/src/test/results/clientnegative/

Author: zshao
Date: Tue Dec  9 14:48:35 2008
New Revision: 724923

URL: http://svn.apache.org/viewvc?rev=724923&view=rev
Log:
HIVE-103. Disable inserts in sub queries. (Namit Jain through zshao)

Added:
    hadoop/hive/trunk/ql/src/test/queries/clientnegative/subq_insert.q
    hadoop/hive/trunk/ql/src/test/results/clientnegative/subq_insert.q.out
Modified:
    hadoop/hive/trunk/CHANGES.txt
    hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/ErrorMsg.java
    hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java

Modified: hadoop/hive/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/CHANGES.txt?rev=724923&r1=724922&r2=724923&view=diff
==============================================================================
--- hadoop/hive/trunk/CHANGES.txt (original)
+++ hadoop/hive/trunk/CHANGES.txt Tue Dec  9 14:48:35 2008
@@ -36,6 +36,8 @@
 
   BUG FIXES
 
+    HIVE-103. Disable inserts in sub queries. (Namit Jain through zshao)
+
     HIVE-92. Fixed union all for non-embedded query. (Namit Jain through zshao)
 
     HIVE-93. Dynamic serde to handle _-prefixed column names in DDL.

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/ErrorMsg.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/ErrorMsg.java?rev=724923&r1=724922&r2=724923&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/ErrorMsg.java (original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/ErrorMsg.java Tue Dec  9 14:48:35 2008
@@ -43,6 +43,7 @@
   DUPLICATE_GROUPBY_KEY("Repeated Key in Group By"),
   UNSUPPORTED_MULTIPLE_DISTINCTS("DISTINCT on Different Columns not Supported"),
   NO_SUBQUERY_ALIAS("No Alias For Subquery"),
+  NO_INSERT_INSUBQUERY("Cannot insert in a Subquery. Inserting to table "),
   NON_KEY_EXPR_IN_GROUPBY("Expression Not In Group By Key"),
   INVALID_XPATH("General . and [] Operators are Not Supported"),
   INVALID_PATH("Invalid Path"),

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java?rev=724923&r1=724922&r2=724923&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java (original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java Tue Dec  9 14:48:35 2008
@@ -343,6 +343,14 @@
         ctx_1.dest = "insclause-" + ctx_1.nextNum;
         ctx_1.nextNum++;
 
+        // is there a insert in the subquery
+        if (qbp.getIsSubQ()) {
+          CommonTree ch = (CommonTree)ast.getChild(0);
+          if ((ch.getToken().getType() != HiveParser.TOK_DIR) ||
+              (((CommonTree)ch.getChild(0)).getToken().getType() != HiveParser.TOK_TMP_FILE))
+            throw new SemanticException(ErrorMsg.NO_INSERT_INSUBQUERY.getMsg(ast));
+        }
+
         qbp.setDestForClause(ctx_1.dest, (CommonTree) ast.getChild(0));
       }
         break;

Added: hadoop/hive/trunk/ql/src/test/queries/clientnegative/subq_insert.q
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/test/queries/clientnegative/subq_insert.q?rev=724923&view=auto
==============================================================================
--- hadoop/hive/trunk/ql/src/test/queries/clientnegative/subq_insert.q (added)
+++ hadoop/hive/trunk/ql/src/test/queries/clientnegative/subq_insert.q Tue Dec  9 14:48:35 2008
@@ -0,0 +1,2 @@
+EXPLAIN
+SELECT * FROM (INSERT OVERWRITE TABLE src1 SELECT * FROM src ) y;

Added: hadoop/hive/trunk/ql/src/test/results/clientnegative/subq_insert.q.out
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/test/results/clientnegative/subq_insert.q.out?rev=724923&view=auto
==============================================================================
--- hadoop/hive/trunk/ql/src/test/results/clientnegative/subq_insert.q.out (added)
+++ hadoop/hive/trunk/ql/src/test/results/clientnegative/subq_insert.q.out Tue Dec  9 14:48:35 2008
@@ -0,0 +1 @@
+FAILED: Error in semantic analysis: line 2:38 Cannot insert in a Subquery. Inserting to table  src1