InvisibleProgrammer commented on code in PR #6784:
URL: https://github.com/apache/hive/pull/6784#discussion_r4390321705
##########
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:
I only went down to the very first usage: HiveConnection used the original
Utils.getCanonicalHostName and in case of error, it gave back the original host
string. Now instead of that, it receives a string, UNKNOWN.
How a jdbc connection behaves if the host is `UNKNOWN`?
Is there a test that covers that behavior change?
--
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]