FAQ
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());
    }
  }

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcommits @
categorieshive, hadoop
postedJan 14, '15 at 5:26p
activeJan 14, '15 at 5:26p
posts1
users1
websitehive.apache.org

1 user in discussion

Ekoifman: 1 post

People

Translate

site design / logo © 2021 Grokbase