You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by jc...@apache.org on 2017/01/18 10:13:20 UTC
[1/4] hive git commit: Revert "HIVE-15550 : fix arglist logging in
schematool - add missing test file"
Repository: hive
Updated Branches:
refs/heads/master ffeb6c87c -> 3792a4a61
Revert "HIVE-15550 : fix arglist logging in schematool - add missing test file"
This reverts commit 8ff096548d0f94f9abb5361cce9539e71613e5d8.
Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/f225d092
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/f225d092
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/f225d092
Branch: refs/heads/master
Commit: f225d09211dfede75398116cd4ae5f265257f743
Parents: ffeb6c8
Author: Jesus Camacho Rodriguez <jc...@apache.org>
Authored: Wed Jan 18 10:05:18 2017 +0000
Committer: Jesus Camacho Rodriguez <jc...@apache.org>
Committed: Wed Jan 18 10:05:18 2017 +0000
----------------------------------------------------------------------
.../apache/hive/beeline/TestHiveSchemaTool.java | 73 --------------------
1 file changed, 73 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/f225d092/beeline/src/test/org/apache/hive/beeline/TestHiveSchemaTool.java
----------------------------------------------------------------------
diff --git a/beeline/src/test/org/apache/hive/beeline/TestHiveSchemaTool.java b/beeline/src/test/org/apache/hive/beeline/TestHiveSchemaTool.java
deleted file mode 100644
index 8d386da..0000000
--- a/beeline/src/test/org/apache/hive/beeline/TestHiveSchemaTool.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package org.apache.hive.beeline;
-
-import org.apache.hadoop.hive.conf.HiveConf;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.powermock.core.classloader.annotations.PowerMockIgnore;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Arrays;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Matchers.same;
-import static org.mockito.Mockito.when;
-import static org.powermock.api.mockito.PowerMockito.mockStatic;
-import static org.powermock.api.mockito.PowerMockito.verifyStatic;
-
-@RunWith(PowerMockRunner.class)
-@PowerMockIgnore("javax.management.*")
-@PrepareForTest({ HiveSchemaHelper.class, HiveSchemaTool.CommandBuilder.class })
-public class TestHiveSchemaTool {
-
- String scriptFile = System.getProperty("java.io.tmpdir") + File.separator + "someScript.sql";
- @Mock
- private HiveConf hiveConf;
- private HiveSchemaTool.CommandBuilder builder;
- private String pasword = "reallySimplePassword";
-
- @Before
- public void setup() throws IOException {
- mockStatic(HiveSchemaHelper.class);
- when(HiveSchemaHelper
- .getValidConfVar(eq(HiveConf.ConfVars.METASTORECONNECTURLKEY), same(hiveConf)))
- .thenReturn("someURL");
- when(HiveSchemaHelper
- .getValidConfVar(eq(HiveConf.ConfVars.METASTORE_CONNECTION_DRIVER), same(hiveConf)))
- .thenReturn("someDriver");
-
- File file = new File(scriptFile);
- if (!file.exists()) {
- file.createNewFile();
- }
- builder = new HiveSchemaTool.CommandBuilder(hiveConf, "testUser", pasword, scriptFile);
- }
-
- @After
- public void globalAssert() throws IOException {
- verifyStatic();
- HiveSchemaHelper.getValidConfVar(eq(HiveConf.ConfVars.METASTORECONNECTURLKEY), same(hiveConf));
- HiveSchemaHelper
- .getValidConfVar(eq(HiveConf.ConfVars.METASTORE_CONNECTION_DRIVER), same(hiveConf));
-
- new File(scriptFile).delete();
- }
-
- @Test
- public void shouldReturnStrippedPassword() throws IOException {
- assertFalse(builder.buildToLog().contains(pasword));
- }
-
- @Test
- public void shouldReturnActualPassword() throws IOException {
- String[] strings = builder.buildToRun();
- assertTrue(Arrays.asList(strings).contains(pasword));
- }
-}
\ No newline at end of file
[3/4] hive git commit: Revert "HIVE-15648: Hive throws compilation
error due to powermock.version not being present in root pom (Vaibhav
Gumashta reviewed by Thejas Nair)"
Posted by jc...@apache.org.
Revert "HIVE-15648: Hive throws compilation error due to powermock.version not being present in root pom (Vaibhav Gumashta reviewed by Thejas Nair)"
This reverts commit ec82b84f309119121dc55aa84c1b9b70e7a0c334.
Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/a6148a58
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/a6148a58
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/a6148a58
Branch: refs/heads/master
Commit: a6148a587992742e98839552c70e5799e4bba3f1
Parents: 85be425
Author: Jesus Camacho Rodriguez <jc...@apache.org>
Authored: Wed Jan 18 10:05:42 2017 +0000
Committer: Jesus Camacho Rodriguez <jc...@apache.org>
Committed: Wed Jan 18 10:05:42 2017 +0000
----------------------------------------------------------------------
beeline/pom.xml | 1 +
pom.xml | 1 -
2 files changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/a6148a58/beeline/pom.xml
----------------------------------------------------------------------
diff --git a/beeline/pom.xml b/beeline/pom.xml
index 9d30a9e..58ca92e 100644
--- a/beeline/pom.xml
+++ b/beeline/pom.xml
@@ -29,6 +29,7 @@
<properties>
<hive.path.to.root>..</hive.path.to.root>
+ <powermock.version>1.6.6</powermock.version>
</properties>
<dependencies>
http://git-wip-us.apache.org/repos/asf/hive/blob/a6148a58/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index b499cd2..5d5e172 100644
--- a/pom.xml
+++ b/pom.xml
@@ -202,7 +202,6 @@
<jsr305.version>3.0.0</jsr305.version>
<tephra.version>0.6.0</tephra.version>
<gson.version>2.2.4</gson.version>
- <powermock.version>1.6.6</powermock.version>
</properties>
<repositories>
[2/4] hive git commit: Revert "Update errata.txt for HIVE-15550"
Posted by jc...@apache.org.
Revert "Update errata.txt for HIVE-15550"
This reverts commit a6bba80e15df4dc5f1b01ae519dea23ccc497945.
Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/85be4250
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/85be4250
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/85be4250
Branch: refs/heads/master
Commit: 85be4250c881865e183d8bdd366b318309162ef9
Parents: f225d09
Author: Jesus Camacho Rodriguez <jc...@apache.org>
Authored: Wed Jan 18 10:05:30 2017 +0000
Committer: Jesus Camacho Rodriguez <jc...@apache.org>
Committed: Wed Jan 18 10:05:30 2017 +0000
----------------------------------------------------------------------
errata.txt | 1 -
1 file changed, 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/85be4250/errata.txt
----------------------------------------------------------------------
diff --git a/errata.txt b/errata.txt
index f5c977b..1425266 100644
--- a/errata.txt
+++ b/errata.txt
@@ -1,7 +1,6 @@
Commits with the wrong or no JIRA referenced:
git commit branch jira url
-ea87e0f26112f0cdbe2fa06e3090fb7b49d81569 master HIVE-15550 https://issues.apache.org/jira/browse/HIVE-15550
5a576b6fbf1680ab4dd8f275cad484a2614ef2c1 master HIVE-10391 https://issues.apache.org/jira/browse/HIVE-10391
582f4e1bc39b9605d11f762480b29561a44688ae llap HIVE-10217 https://issues.apache.org/jira/browse/HIVE-10217
8981f365bf0cf921bc0ac2ff8914df44ca2f7de7 master HIVE-10500 https://issues.apache.org/jira/browse/HIVE-10500
[4/4] hive git commit: Revert "HIVE-15550: fix arglist logging in
schematool (Anishek Agarwal via Thejas Nair)"
Posted by jc...@apache.org.
Revert "HIVE-15550: fix arglist logging in schematool (Anishek Agarwal via Thejas Nair)"
This reverts commit ea87e0f26112f0cdbe2fa06e3090fb7b49d81569.
Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/3792a4a6
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/3792a4a6
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/3792a4a6
Branch: refs/heads/master
Commit: 3792a4a61805f005d88ae3fc5da2a528be2ca212
Parents: a6148a5
Author: Jesus Camacho Rodriguez <jc...@apache.org>
Authored: Wed Jan 18 10:05:56 2017 +0000
Committer: Jesus Camacho Rodriguez <jc...@apache.org>
Committed: Wed Jan 18 10:05:56 2017 +0000
----------------------------------------------------------------------
beeline/pom.xml | 12 +--
.../org/apache/hive/beeline/HiveSchemaTool.java | 80 +++++++++-----------
pom.xml | 11 +--
3 files changed, 38 insertions(+), 65 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/3792a4a6/beeline/pom.xml
----------------------------------------------------------------------
diff --git a/beeline/pom.xml b/beeline/pom.xml
index 58ca92e..5503add 100644
--- a/beeline/pom.xml
+++ b/beeline/pom.xml
@@ -29,7 +29,6 @@
<properties>
<hive.path.to.root>..</hive.path.to.root>
- <powermock.version>1.6.6</powermock.version>
</properties>
<dependencies>
@@ -120,15 +119,8 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-module-junit4</artifactId>
- <version>${powermock.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito</artifactId>
- <version>${powermock.version}</version>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
<scope>test</scope>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/hive/blob/3792a4a6/beeline/src/java/org/apache/hive/beeline/HiveSchemaTool.java
----------------------------------------------------------------------
diff --git a/beeline/src/java/org/apache/hive/beeline/HiveSchemaTool.java b/beeline/src/java/org/apache/hive/beeline/HiveSchemaTool.java
index ea58776..a981bce 100644
--- a/beeline/src/java/org/apache/hive/beeline/HiveSchemaTool.java
+++ b/beeline/src/java/org/apache/hive/beeline/HiveSchemaTool.java
@@ -815,10 +815,38 @@ public class HiveSchemaTool {
// Generate the beeline args per hive conf and execute the given script
public void runBeeLine(String sqlScriptFile) throws IOException {
- CommandBuilder builder = new CommandBuilder(hiveConf, userName, passWord, sqlScriptFile);
+ List<String> argList = new ArrayList<String>();
+ argList.add("-u");
+ argList.add(HiveSchemaHelper.getValidConfVar(
+ ConfVars.METASTORECONNECTURLKEY, hiveConf));
+ argList.add("-d");
+ argList.add(HiveSchemaHelper.getValidConfVar(
+ ConfVars.METASTORE_CONNECTION_DRIVER, hiveConf));
+ argList.add("-n");
+ argList.add(userName);
+ argList.add("-p");
+ argList.add(passWord);
+ argList.add("-f");
+ argList.add(sqlScriptFile);
+
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Going to invoke file that contains:");
+ BufferedReader reader = new BufferedReader(new FileReader(sqlScriptFile));
+ try {
+ String line;
+ while ((line = reader.readLine()) != null) {
+ LOG.debug("script: " + line);
+ }
+ } finally {
+ if (reader != null) {
+ reader.close();
+ }
+ }
+ }
// run the script using Beeline
- try (BeeLine beeLine = new BeeLine()) {
+ BeeLine beeLine = new BeeLine();
+ try {
if (!verbose) {
beeLine.setOutputStream(new PrintStream(new NullOutputStream()));
beeLine.getOpts().setSilent(true);
@@ -828,53 +856,13 @@ public class HiveSchemaTool {
// We can be pretty sure that an entire line can be processed as a single command since
// we always add a line separator at the end while calling dbCommandParser.buildCommand.
beeLine.getOpts().setEntireLineAsCommand(true);
- LOG.debug("Going to run command <" + builder.buildToLog() + ">");
- int status = beeLine.begin(builder.buildToRun(), null);
+ LOG.debug("Going to run command <" + StringUtils.join(argList, " ") + ">");
+ int status = beeLine.begin(argList.toArray(new String[0]), null);
if (status != 0) {
throw new IOException("Schema script failed, errorcode " + status);
}
- }
- }
-
- static class CommandBuilder {
- private final HiveConf hiveConf;
- private final String userName;
- private final String password;
- private final String sqlScriptFile;
-
- CommandBuilder(HiveConf hiveConf, String userName, String password, String sqlScriptFile) {
- this.hiveConf = hiveConf;
- this.userName = userName;
- this.password = password;
- this.sqlScriptFile = sqlScriptFile;
- }
-
- String[] buildToRun() throws IOException {
- return argsWith(password);
- }
-
- String buildToLog() throws IOException {
- logScript();
- return StringUtils.join(argsWith(BeeLine.PASSWD_MASK), " ");
- }
-
- private String[] argsWith(String password) throws IOException {
- return new String[] { "-u",
- HiveSchemaHelper.getValidConfVar(ConfVars.METASTORECONNECTURLKEY, hiveConf), "-d",
- HiveSchemaHelper.getValidConfVar(ConfVars.METASTORE_CONNECTION_DRIVER, hiveConf), "-n",
- userName, "-p", password, "-f", sqlScriptFile };
- }
-
- private void logScript() throws IOException {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Going to invoke file that contains:");
- try (BufferedReader reader = new BufferedReader(new FileReader(sqlScriptFile))) {
- String line;
- while ((line = reader.readLine()) != null) {
- LOG.debug("script: " + line);
- }
- }
- }
+ } finally {
+ beeLine.close();
}
}
http://git-wip-us.apache.org/repos/asf/hive/blob/3792a4a6/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 5d5e172..0a55c7c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -777,15 +777,8 @@
<version>${slf4j.version}</version>
</dependency>
<dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-module-junit4</artifactId>
- <version>${powermock.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito</artifactId>
- <version>${powermock.version}</version>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
<scope>test</scope>
</dependency>
</dependencies>