pkumarsinha commented on code in PR #4731:
URL: https://github.com/apache/hive/pull/4731#discussion_r1352815310


##########
ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java:
##########
@@ -1321,6 +1321,45 @@ public void printInfo(String info, String detail, 
boolean isSilent) {
       LOG.info(info + StringUtils.defaultString(detail));
     }
 
+    /**
+     * Logs warn into the log file, and if the LogHelper is not silent then 
into the HiveServer2 or
+     * HiveCli info stream too.
+     * BeeLine uses the operation log file to show the logs to the user, so 
depending on the
+     * BeeLine settings it could be shown to the user.
+     * @param warn The log message
+     */
+    public void printWarn(String warn) {
+      printWarn(warn, null);
+    }
+
+    /**
+     * Logs warn into the log file, and if the LogHelper is not silent then 
into the HiveServer2 or
+     * HiveCli info stream too. Handles an extra detail which will not be 
printed if null.
+     * BeeLine uses the operation log file to show the logs to the user, so 
depending on the
+     * BeeLine settings it could be shown to the user.
+     * @param warn The log message
+     * @param detail Extra detail to log which will be not printed if null
+     */
+    public void printWarn(String warn, String detail) {
+      printWarn(warn, detail, getIsSilent());
+    }
+
+    /**
+     * Logs warn into the log file, and if not silent then into the 
HiveServer2 or HiveCli info
+     * stream too. Handles an extra detail which will not be printed if null.
+     * BeeLine uses the operation log file to show the logs to the user, so 
depending on the
+     * BeeLine settings it could be shown to the user.
+     * @param warn The log message
+     * @param detail Extra detail to log which will be not printed if null
+     * @param isSilent If true then the message will not be printed to the 
info stream
+     */
+    public void printWarn(String warn, String detail, boolean isSilent) {
+      if (!isSilent) {
+        getInfoStream().println(warn);
+      }
+      LOG.warn(warn + 
org.apache.commons.lang.StringUtils.defaultString(detail));

Review Comment:
   Can we not use lang3's StringUtils.defaultString ?



-- 
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: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to