Repository: hive Updated Branches: refs/heads/master 4f18acd0f -> 338a7ee7d
HIVE-15993 : Hive REPL STATUS is not returning last event ID (Sankar Hariappan, reviewed by Sushanth Sowmyan) Project: http://git-wip-us.apache.org/repos/asf/hive/repo Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/338a7ee7 Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/338a7ee7 Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/338a7ee7 Branch: refs/heads/master Commit: 338a7ee7d4b0112ee666efc3ec7460195f831dfc Parents: 4f18acd Author: Sushanth Sowmyan <[email protected]> Authored: Thu Feb 23 21:03:43 2017 -0800 Committer: Sushanth Sowmyan <[email protected]> Committed: Thu Feb 23 21:04:48 2017 -0800 ---------------------------------------------------------------------- .../hive/ql/parse/ReplicationSemanticAnalyzer.java | 1 + .../ql/parse/TestReplicationSemanticAnalyzer.java | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hive/blob/338a7ee7/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 d24eb59..cb1371c 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 @@ -1349,6 +1349,7 @@ public class ReplicationSemanticAnalyzer extends BaseSemanticAnalyzer { } prepareReturnValues(Collections.singletonList(replLastId), "last_repl_id#string"); + setFetchTask(createFetchTask("last_repl_id#string")); LOG.debug("ReplicationSemanticAnalyzer.analyzeReplStatus: writing repl.last.id={} out to {}", String.valueOf(replLastId), ctx.getResFile()); } http://git-wip-us.apache.org/repos/asf/hive/blob/338a7ee7/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 af51524..1396a94 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 @@ -31,6 +31,7 @@ import org.apache.hadoop.fs.Path; import org.apache.hadoop.hive.conf.HiveConf; import org.apache.hadoop.hive.ql.Context; import org.apache.hadoop.hive.ql.QueryState; +import org.apache.hadoop.hive.ql.exec.FetchTask; import org.apache.hadoop.hive.ql.exec.Task; import org.apache.hadoop.hive.ql.io.orc.OrcInputFormat; import org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat; @@ -256,4 +257,19 @@ public class TestReplicationSemanticAnalyzer { roots = rs.getRootTasks(); assertEquals(1, roots.size()); } + + @Test + public void testReplStatusAnalyze() throws Exception { + ParseDriver pd = new ParseDriver(); + ASTNode root; + + // Repl status command + String query = "repl status " + defaultDB; + root = (ASTNode) pd.parse(query).getChild(0); + ReplicationSemanticAnalyzer rs = (ReplicationSemanticAnalyzer) SemanticAnalyzerFactory.get(queryState, root); + rs.analyze(root, new Context(conf)); + + FetchTask fetchTask = rs.getFetchTask(); + assertNotNull(fetchTask); + } }
