[GitHub] [incubator-hudi] leesf commented on a change in pull request #1350: [HUDI-629]: Replace Guava's Hashing with an equivalent in NumericUtils.java

2020-02-22 Thread GitBox
leesf commented on a change in pull request #1350: [HUDI-629]: Replace Guava's 
Hashing with an equivalent in NumericUtils.java
URL: https://github.com/apache/incubator-hudi/pull/1350#discussion_r382957503
 
 

 ##
 File path: 
hudi-common/src/main/java/org/apache/hudi/common/util/NumericUtils.java
 ##
 @@ -31,4 +41,28 @@ public static String humanReadableByteCount(double bytes) {
 String pre = "KMGTPE".charAt(exp - 1) + "";
 return String.format("%.1f %sB", bytes / Math.pow(1024, exp), pre);
   }
+
+  public static long getMessageDigestHash(final String algorithmName, final 
String string) {
+MessageDigest md = null;
+try {
+  md = MessageDigest.getInstance(algorithmName);
+} catch (NoSuchAlgorithmException e) {
+  LOGGER.error("Invalid Algorithm Specified: {}", algorithmName);
 
 Review comment:
   How about removing the LOGGER and throwing exception here? though 
Objects.requireNonNull(md) would also throw exception if md is null.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-hudi] leesf commented on a change in pull request #1350: [HUDI-629]: Replace Guava's Hashing with an equivalent in NumericUtils.java

2020-02-22 Thread GitBox
leesf commented on a change in pull request #1350: [HUDI-629]: Replace Guava's 
Hashing with an equivalent in NumericUtils.java
URL: https://github.com/apache/incubator-hudi/pull/1350#discussion_r382957313
 
 

 ##
 File path: 
hudi-hive/src/test/java/org/apache/hudi/hive/util/HiveTestService.java
 ##
 @@ -87,7 +87,7 @@ public Configuration getHadoopConf() {
   }
 
   public HiveServer2 start() throws IOException {
-Preconditions.checkState(workDir != null, "The work dir must be set before 
starting cluster.");
+Objects.requireNonNull(workDir, "The work dir must be set before starting 
cluster.");
 
 Review comment:
   ditto


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-hudi] leesf commented on a change in pull request #1350: [HUDI-629]: Replace Guava's Hashing with an equivalent in NumericUtils.java

2020-02-22 Thread GitBox
leesf commented on a change in pull request #1350: [HUDI-629]: Replace Guava's 
Hashing with an equivalent in NumericUtils.java
URL: https://github.com/apache/incubator-hudi/pull/1350#discussion_r382957273
 
 

 ##
 File path: 
hudi-common/src/test/java/org/apache/hudi/common/minicluster/HdfsTestService.java
 ##
 @@ -66,7 +66,7 @@ public Configuration getHadoopConf() {
   }
 
   public MiniDFSCluster start(boolean format) throws IOException {
-Preconditions.checkState(workDir != null, "The work dir must be set before 
starting cluster.");
+Objects.requireNonNull(workDir, "The work dir must be set before starting 
cluster.");
 
 Review comment:
   How about adding `checkState` to ValidationUtils?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services