hive-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thejas M Nair (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HIVE-16584) Warning messages should use LogHelper.printInfo instead of printing to the infoStream directly
Date Thu, 04 May 2017 20:07:04 GMT

    [ https://issues.apache.org/jira/browse/HIVE-16584?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15997357#comment-15997357
] 

Thejas M Nair commented on HIVE-16584:
--------------------------------------

+1
Some warnings are missing as a result.
Great minds think alike! :)  - I had created a partial patch (unverified) yesterday. Pasting
it here in case it helps you -
{code}
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/physical/CrossProductCheck.java
b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/physical/CrossProductCheck.java
index 9ad33fdc39..5e0a3eaf6f 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/physical/CrossProductCheck.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/physical/CrossProductCheck.java
@@ -128,8 +128,7 @@ public Object dispatch(Node nd, Stack<Node> stack, Object... nodeOutputs)
   }
 
   private void warn(String msg) {
-    SessionState.getConsole().getInfoStream().println(
-        String.format("Warning: %s", msg));
+    SessionState.getConsole().printInfo("Warning: %s" + msg);
   }
 
   private void checkMapJoins(MapRedTask mrTsk) throws SemanticException {
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFUnixTimeStamp.java
b/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFUnixTimeStamp.java
index 118acdc22a..adeb09a5df 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFUnixTimeStamp.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFUnixTimeStamp.java
@@ -38,7 +38,6 @@
     extended = "Converts the specified time to number of seconds "
         + "since 1970-01-01. The _FUNC_(void) overload is deprecated, use current_timestamp.")
 public class GenericUDFUnixTimeStamp extends GenericUDFToUnixTimeStamp {
-  private static final Logger LOG = LoggerFactory.getLogger(GenericUDFUnixTimeStamp.class);
   private LongWritable currentTimestamp; // retValue is transient so store this separately.
   @Override
   protected void initializeInput(ObjectInspector[] arguments) throws UDFArgumentException
{
@@ -49,7 +48,7 @@ protected void initializeInput(ObjectInspector[] arguments) throws UDFArgumentEx
         currentTimestamp = new LongWritable(0);
         setValueFromTs(currentTimestamp, SessionState.get().getQueryCurrentTimestamp());
         String msg = "unix_timestamp(void) is deprecated. Use current_timestamp instead.";
-        LOG.warn(msg);
+        SessionState.get().getConsole().printError(msg);
         PrintStream stream = LogHelper.getInfoStream();
         if (stream != null) {
           stream.println(msg);

{code}

> Warning messages should use LogHelper.printInfo instead of printing to the infoStream
directly
> ----------------------------------------------------------------------------------------------
>
>                 Key: HIVE-16584
>                 URL: https://issues.apache.org/jira/browse/HIVE-16584
>             Project: Hive
>          Issue Type: Bug
>          Components: Logging
>    Affects Versions: 3.0.0
>            Reporter: Peter Vary
>            Assignee: Peter Vary
>
> There are several cases when warning messages are printed to the console outputstream
directly. These warnings do not show up in the BeeLine output.
> We should use the the printInfo method instead.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message