deniskuzZ commented on a change in pull request #2079:
URL: https://github.com/apache/hive/pull/2079#discussion_r595896220



##########
File path: 
ql/src/java/org/apache/hadoop/hive/ql/ddl/process/show/compactions/ShowCompactionsOperation.java
##########
@@ -124,6 +128,25 @@ private void writeRow(DataOutputStream os, 
ShowCompactResponseElement e) throws
     os.write(Utilities.tabCode);
     String error = e.getErrorMessage();
     os.writeBytes(error == null ? NO_VAL : error);
+    os.writeBytes(getHostFromId(e.getInitiatorId()));
+    os.write(Utilities.tabCode);
+    os.writeBytes(getThreadIdFromId(e.getInitiatorId()));
     os.write(Utilities.newLineCode);
   }
+
+  private String getHostFromId(String id) {
+    if (id == null) {
+      return NO_VAL;
+    }
+    String[] parts = id.split("-");
+    return String.join("-", Arrays.copyOfRange(parts, 0, parts.length - 1));

Review comment:
       looks like too many manipulations. how about: id.substring(0, 
id.lastIndexOf('-')) ?




----------------------------------------------------------------
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to