hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ser...@apache.org
Subject [03/20] hive git commit: HIVE-15668 : change REPL DUMP syntax to use "LIMIT" instead of "BATCH" keyword
Date Mon, 27 Feb 2017 20:24:05 GMT
HIVE-15668 : change REPL DUMP syntax to use "LIMIT" instead of "BATCH" keyword


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/4f18acd0
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/4f18acd0
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/4f18acd0

Branch: refs/heads/hive-14535
Commit: 4f18acd0ff52acce292daccb82207940c1d766cd
Parents: 2768361
Author: Sushanth Sowmyan <khorgath@gmail.com>
Authored: Thu Feb 23 18:55:11 2017 -0800
Committer: Sushanth Sowmyan <khorgath@gmail.com>
Committed: Thu Feb 23 18:56:24 2017 -0800

----------------------------------------------------------------------
 .../org/apache/hadoop/hive/ql/parse/HiveLexer.g   |  1 -
 .../org/apache/hadoop/hive/ql/parse/HiveParser.g  |  8 ++++----
 .../ql/parse/ReplicationSemanticAnalyzer.java     | 18 +++++++-----------
 .../ql/parse/TestReplicationSemanticAnalyzer.java |  8 ++++----
 4 files changed, 15 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/4f18acd0/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveLexer.g
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveLexer.g b/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveLexer.g
index f80642b..ad61f83 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveLexer.g
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveLexer.g
@@ -340,7 +340,6 @@ KW_MERGE: 'MERGE';
 KW_MATCHED: 'MATCHED';
 KW_REPL: 'REPL';
 KW_DUMP: 'DUMP';
-KW_BATCH: 'BATCH';
 KW_STATUS: 'STATUS';
 KW_VECTORIZATION: 'VECTORIZATION';
 KW_SUMMARY: 'SUMMARY';

http://git-wip-us.apache.org/repos/asf/hive/blob/4f18acd0/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g b/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g
index b4b5bfb..61778f6 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g
@@ -386,10 +386,10 @@ TOK_MERGE;
 TOK_MATCHED;
 TOK_NOT_MATCHED;
 TOK_UPDATE;
-TOK_DELETE;TOK_REPL_DUMP;
+TOK_DELETE;
+TOK_REPL_DUMP;
 TOK_REPL_LOAD;
 TOK_REPL_STATUS;
-TOK_BATCH;
 TOK_TO;
 TOK_ONLY;
 TOK_SUMMARY;
@@ -817,9 +817,9 @@ replDumpStatement
         (dbName=identifier) (DOT tblName=identifier)?
         (KW_FROM (eventId=Number)
           (KW_TO (rangeEnd=Number))?
-          (KW_BATCH (batchSize=Number))?
+          (KW_LIMIT (batchSize=Number))?
         )?
-    -> ^(TOK_REPL_DUMP $dbName $tblName? ^(TOK_FROM $eventId (TOK_TO $rangeEnd)? (TOK_BATCH
$batchSize)?)? )
+    -> ^(TOK_REPL_DUMP $dbName $tblName? ^(TOK_FROM $eventId (TOK_TO $rangeEnd)? (TOK_LIMIT
$batchSize)?)? )
     ;
 
 replLoadStatement

http://git-wip-us.apache.org/repos/asf/hive/blob/4f18acd0/ql/src/java/org/apache/hadoop/hive/ql/parse/ReplicationSemanticAnalyzer.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/ReplicationSemanticAnalyzer.java
b/ql/src/java/org/apache/hadoop/hive/ql/parse/ReplicationSemanticAnalyzer.java
index 37baca1..d24eb59 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/ReplicationSemanticAnalyzer.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/ReplicationSemanticAnalyzer.java
@@ -95,7 +95,7 @@ public class ReplicationSemanticAnalyzer extends BaseSemanticAnalyzer {
   private String tblNameOrPattern;
   private Long eventFrom;
   private Long eventTo;
-  private Integer batchSize;
+  private Integer maxEventLimit;
   // Base path for REPL LOAD
   private String path;
 
@@ -290,8 +290,8 @@ public class ReplicationSemanticAnalyzer extends BaseSemanticAnalyzer
{
                 Long.parseLong(PlanUtils.stripQuotes(fromNode.getChild(numChild + 1).getText()));
             // skip the next child, since we already took care of it
             numChild++;
-          } else if (fromNode.getChild(numChild).getType() == TOK_BATCH) {
-            batchSize =
+          } else if (fromNode.getChild(numChild).getType() == TOK_LIMIT) {
+            maxEventLimit =
                 Integer.parseInt(PlanUtils.stripQuotes(fromNode.getChild(numChild + 1).getText()));
             // skip the next child, since we already took care of it
             numChild++;
@@ -311,7 +311,7 @@ public class ReplicationSemanticAnalyzer extends BaseSemanticAnalyzer
{
   private void analyzeReplDump(ASTNode ast) throws SemanticException {
     LOG.debug("ReplicationSemanticAnalyzer.analyzeReplDump: " + String.valueOf(dbNameOrPattern)
         + "." + String.valueOf(tblNameOrPattern) + " from " + String.valueOf(eventFrom) +
" to "
-        + String.valueOf(eventTo) + " batchsize " + String.valueOf(batchSize));
+        + String.valueOf(eventTo) + " maxEventLimit " + String.valueOf(maxEventLimit));
     String replRoot = conf.getVar(HiveConf.ConfVars.REPLDIR);
     Path dumpRoot = new Path(replRoot, getNextDumpDir());
     DumpMetaData dmd = new DumpMetaData(dumpRoot);
@@ -369,12 +369,8 @@ public class ReplicationSemanticAnalyzer extends BaseSemanticAnalyzer
{
         }
 
         Integer maxRange = Ints.checkedCast(eventTo - eventFrom + 1);
-        if (batchSize == null){
-          batchSize = maxRange;
-        } else {
-          if (batchSize > maxRange){
-            batchSize = maxRange;
-          }
+        if ((maxEventLimit == null) || (maxEventLimit > maxRange)){
+          maxEventLimit = maxRange;
         }
 
         // TODO : instead of simply restricting by message format, we should eventually
@@ -392,7 +388,7 @@ public class ReplicationSemanticAnalyzer extends BaseSemanticAnalyzer
{
             = new EventUtils.MSClientNotificationFetcher(db.getMSC());
 
         EventUtils.NotificationEventIterator evIter = new EventUtils.NotificationEventIterator(
-            evFetcher, eventFrom, batchSize, evFilter);
+            evFetcher, eventFrom, maxEventLimit, evFilter);
 
         while (evIter.hasNext()){
           NotificationEvent ev = evIter.next();

http://git-wip-us.apache.org/repos/asf/hive/blob/4f18acd0/ql/src/test/org/apache/hadoop/hive/ql/parse/TestReplicationSemanticAnalyzer.java
----------------------------------------------------------------------
diff --git a/ql/src/test/org/apache/hadoop/hive/ql/parse/TestReplicationSemanticAnalyzer.java
b/ql/src/test/org/apache/hadoop/hive/ql/parse/TestReplicationSemanticAnalyzer.java
index 54b2bd1..af51524 100644
--- a/ql/src/test/org/apache/hadoop/hive/ql/parse/TestReplicationSemanticAnalyzer.java
+++ b/ql/src/test/org/apache/hadoop/hive/ql/parse/TestReplicationSemanticAnalyzer.java
@@ -72,7 +72,7 @@ public class TestReplicationSemanticAnalyzer {
     ParseDriver pd = new ParseDriver();
     String fromEventId = "100";
     String toEventId = "200";
-    String batchSize = "50";
+    String maxEventLimit = "50";
     ASTNode root;
     ASTNode child;
 
@@ -148,7 +148,7 @@ public class TestReplicationSemanticAnalyzer {
 
     query =
         "repl dump " + defaultDB + "." + tblName + " from " + fromEventId + " to " + toEventId
-            + " batch " + batchSize;
+            + " limit " + maxEventLimit;
 
     root = (ASTNode) pd.parse(query).getChild(0);
     assertEquals(root.getChildCount(), 3);
@@ -178,11 +178,11 @@ public class TestReplicationSemanticAnalyzer {
     assertEquals(child.getChildCount(), 0);
 
     child =  (ASTNode) root.getChild(3);
-    assertEquals(child.getText(), "TOK_BATCH");
+    assertEquals(child.getText(), "TOK_LIMIT");
     assertEquals(child.getChildCount(), 0);
 
     child =  (ASTNode) root.getChild(4);
-    assertEquals(child.getText(), batchSize);
+    assertEquals(child.getText(), maxEventLimit);
     assertEquals(child.getChildCount(), 0);
   }
 


Mime
View raw message