hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ekoif...@apache.org
Subject svn commit: r1651737 - in /hive/trunk/ql/src: java/org/apache/hadoop/hive/ql/parse/HiveParser.g test/org/apache/hadoop/hive/ql/parse/TestIUD.java
Date Wed, 14 Jan 2015 17:26:23 GMT
Author: ekoifman
Date: Wed Jan 14 17:26:22 2015
New Revision: 1651737

URL: http://svn.apache.org/r1651737
Log:
HIVE-9353 - make TABLE keyword optional in INSERT INTO TABLE foo...

Modified:
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g
    hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/parse/TestIUD.java

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g?rev=1651737&r1=1651736&r2=1651737&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g Wed Jan 14 17:26:22
2015
@@ -2216,7 +2216,7 @@ insertClause
 @after { popMsg(state); }
    :
      KW_INSERT KW_OVERWRITE destination ifNotExists? -> ^(TOK_DESTINATION destination
ifNotExists?)
-   | KW_INSERT KW_INTO KW_TABLE tableOrPartition
+   | KW_INSERT KW_INTO KW_TABLE? tableOrPartition
        -> ^(TOK_INSERT_INTO tableOrPartition)
    ;
 

Modified: hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/parse/TestIUD.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/parse/TestIUD.java?rev=1651737&r1=1651736&r2=1651737&view=diff
==============================================================================
--- hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/parse/TestIUD.java (original)
+++ hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/parse/TestIUD.java Wed Jan 14 17:26:22
2015
@@ -193,7 +193,7 @@ public class TestIUD {
   }
   @Test
   public void testInsertIntoTableAsSelectFromNamedVirtTable() throws ParseException {
-    ASTNode ast = parse("insert into table page_view select a,b as c from (values (1,2),(3,4))
as VC(a,b) where b = 9");
+    ASTNode ast = parse("insert into page_view select a,b as c from (values (1,2),(3,4))
as VC(a,b) where b = 9");
     Assert.assertEquals("AST doesn't match",
       "(TOK_QUERY " +
         "(TOK_FROM " +
@@ -209,7 +209,7 @@ public class TestIUD {
   }
   @Test
   public void testInsertIntoTableFromAnonymousTable1Row() throws ParseException {
-    ASTNode ast = parse("insert into table page_view values(1,2)");
+    ASTNode ast = parse("insert into page_view values(1,2)");
     Assert.assertEquals("AST doesn't match",
       "(TOK_QUERY " +
         "(TOK_FROM " +
@@ -232,5 +232,16 @@ public class TestIUD {
         "(TOK_INSERT (TOK_INSERT_INTO (TOK_TAB (TOK_TABNAME page_view))) " +
           "(TOK_SELECT (TOK_SELEXPR TOK_ALLCOLREF))))",
       ast.toStringTree());
+    //same query as above less the "table" keyword KW_TABLE
+    ast = parse("insert into page_view values(-1,2),(3,+4)");
+    Assert.assertEquals("AST doesn't match",
+      "(TOK_QUERY " +
+        "(TOK_FROM " +
+        "(TOK_VIRTUAL_TABLE " +
+        "(TOK_VIRTUAL_TABREF TOK_ANONYMOUS) " +
+        "(TOK_VALUES_TABLE (TOK_VALUE_ROW (- 1) 2) (TOK_VALUE_ROW 3 (+ 4))))) " +
+        "(TOK_INSERT (TOK_INSERT_INTO (TOK_TAB (TOK_TABNAME page_view))) " +
+        "(TOK_SELECT (TOK_SELEXPR TOK_ALLCOLREF))))",
+      ast.toStringTree());
   }
 }



Mime
View raw message