This is an automated email from the ASF dual-hosted git repository.
kgyrtkirk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git
The following commit(s) were added to refs/heads/master by this push:
new 68f96a4 HIVE-23629: Enforce clean findbugs in PRs (#1069)
68f96a4 is described below
commit 68f96a402472c27e03a7857b739cd35bf4927853
Author: Mustafa İman <[email protected]>
AuthorDate: Thu Jun 11 11:33:58 2020 -0700
HIVE-23629: Enforce clean findbugs in PRs (#1069)
* HIVE-23629: Enforce clean findbugs in PRs
Change-Id: Ided89254e2464cf9a6f5ebfdce5c1f222988d18e
* HIVE-23629: Fix findbugs errors in hive-shims-common
Change-Id: I8f3d6e321244b65e27b2e3d0f30c8eb2e39778c1
---
Jenkinsfile | 7 +++++++
.../main/java/org/apache/hadoop/fs/ProxyFileSystem.java | 4 +---
.../java/org/apache/hadoop/fs/ProxyLocalFileSystem.java | 1 -
.../src/main/java/org/apache/hadoop/hive/io/HdfsUtils.java | 2 +-
.../java/org/apache/hadoop/hive/shims/CombineHiveKey.java | 14 ++++++++++++++
.../org/apache/hadoop/hive/shims/HadoopShimsSecure.java | 3 ---
6 files changed, 23 insertions(+), 8 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 37ca448..c7dbb05 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -168,6 +168,13 @@ jobWrappers {
stage('Checkout') {
checkout scm
}
+ stage('Prechecks') {
+ def findbugsProjects = [
+ ":hive-shims-aggregator",
+ ":hive-shims-common"
+ ]
+ buildHive("-Pfindbugs -pl " + findbugsProjects.join(",") + " -am
compile findbugs:check")
+ }
stage('Compile') {
buildHive("install -Dtest=noMatches")
}
diff --git
a/shims/common/src/main/java/org/apache/hadoop/fs/ProxyFileSystem.java
b/shims/common/src/main/java/org/apache/hadoop/fs/ProxyFileSystem.java
index 9e52ebf..7d1d6dd 100644
--- a/shims/common/src/main/java/org/apache/hadoop/fs/ProxyFileSystem.java
+++ b/shims/common/src/main/java/org/apache/hadoop/fs/ProxyFileSystem.java
@@ -42,7 +42,6 @@ public class ProxyFileSystem extends FilterFileSystem {
protected String realScheme;
protected String realAuthority;
- protected URI realUri;
@@ -103,8 +102,7 @@ public class ProxyFileSystem extends FilterFileSystem {
URI realUri = fs.getUri();
this.realScheme = realUri.getScheme();
- this.realAuthority=realUri.getAuthority();
- this.realUri = realUri;
+ this.realAuthority = realUri.getAuthority();
this.myScheme = myUri.getScheme();
this.myAuthority=myUri.getAuthority();
diff --git
a/shims/common/src/main/java/org/apache/hadoop/fs/ProxyLocalFileSystem.java
b/shims/common/src/main/java/org/apache/hadoop/fs/ProxyLocalFileSystem.java
index 8d94bbc..83bb39b 100644
--- a/shims/common/src/main/java/org/apache/hadoop/fs/ProxyLocalFileSystem.java
+++ b/shims/common/src/main/java/org/apache/hadoop/fs/ProxyLocalFileSystem.java
@@ -58,7 +58,6 @@ public class ProxyLocalFileSystem extends FilterFileSystem {
// the scheme/authority serving as the proxy is derived
// from the supplied URI
this.scheme = name.getScheme();
- String nameUriString = name.toString();
String authority = name.getAuthority() != null ? name.getAuthority() : "";
String proxyUriString = scheme + "://" + authority + "/";
diff --git
a/shims/common/src/main/java/org/apache/hadoop/hive/io/HdfsUtils.java
b/shims/common/src/main/java/org/apache/hadoop/hive/io/HdfsUtils.java
index e59eb32..adf4d41 100644
--- a/shims/common/src/main/java/org/apache/hadoop/hive/io/HdfsUtils.java
+++ b/shims/common/src/main/java/org/apache/hadoop/hive/io/HdfsUtils.java
@@ -176,7 +176,7 @@ public class HdfsUtils {
Iterables.removeIf(entries, new Predicate<AclEntry>() {
@Override
public boolean apply(AclEntry input) {
- if (input.getName() == null) {
+ if (input != null && input.getName() == null) {
return true;
}
return false;
diff --git
a/shims/common/src/main/java/org/apache/hadoop/hive/shims/CombineHiveKey.java
b/shims/common/src/main/java/org/apache/hadoop/hive/shims/CombineHiveKey.java
index 859b637..6eb83b8 100644
---
a/shims/common/src/main/java/org/apache/hadoop/hive/shims/CombineHiveKey.java
+++
b/shims/common/src/main/java/org/apache/hadoop/hive/shims/CombineHiveKey.java
@@ -21,6 +21,7 @@ package org.apache.hadoop.hive.shims;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
+import java.util.Objects;
import org.apache.hadoop.io.WritableComparable;
@@ -51,4 +52,17 @@ public class CombineHiveKey implements WritableComparable {
assert false;
return 0;
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ CombineHiveKey that = (CombineHiveKey) o;
+ return Objects.equals(key, that.key);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(key);
+ }
}
\ No newline at end of file
diff --git
a/shims/common/src/main/java/org/apache/hadoop/hive/shims/HadoopShimsSecure.java
b/shims/common/src/main/java/org/apache/hadoop/hive/shims/HadoopShimsSecure.java
index 1150651..9567a3d 100644
---
a/shims/common/src/main/java/org/apache/hadoop/hive/shims/HadoopShimsSecure.java
+++
b/shims/common/src/main/java/org/apache/hadoop/hive/shims/HadoopShimsSecure.java
@@ -125,9 +125,7 @@ public abstract class HadoopShimsSecure implements
HadoopShims {
protected CombineFileSplit split;
protected JobConf jc;
protected Reporter reporter;
- protected Class<RecordReader<K, V>> rrClass;
protected Constructor<RecordReader<K, V>> rrConstructor;
- protected FileSystem fs;
protected int idx;
protected long progress;
@@ -193,7 +191,6 @@ public abstract class HadoopShimsSecure implements
HadoopShims {
throws IOException {
this.split = split;
this.jc = job;
- this.rrClass = rrClass;
this.reporter = reporter;
this.idx = 0;
this.curReader = null;