InvisibleProgrammer commented on code in PR #6784:
URL: https://github.com/apache/hive/pull/6784#discussion_r4390352594
##########
common/src/java/org/apache/hadoop/hive/common/ServerUtils.java:
##########
@@ -68,15 +70,58 @@ public static InetAddress getHostAddress(String hostname)
throws UnknownHostExce
}
return serverIPAddress;
}
+
+ /**
+ * Get the IP address string (e.g. "192.168.1.50") for the given host name.
+ * @param hostname The name of the host
+ * @return The network address of the host and UNKNOWN if resolution fails
+ */
+ public static String getHostAddressString(String hostname) {
+ try {
+ return InetAddress.getByName(hostname).getHostAddress();
+ } catch (UnknownHostException e) {
+ LOG.warn("Error trying to get host address for {}: {}", hostname,
e.getMessage());
+ return "UNKNOWN";
Review Comment:
If we want to make sure the change breaks nothing, I see two possible
approach:
- document all the behavior changes in the PR and add tests that prove Hive
still works after the behavior change (please note, it can be extremely
challenging).
- modify the common API in a way it fulfills the goal of unification and
also keeps the exisiting behavior.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]