[
https://issues.apache.org/jira/browse/HIVE-9242?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14262745#comment-14262745
]
Brock Noland commented on HIVE-9242:
------------------------------------
bq. In this specific case exception is caught and thrown up as runtime
exception. I am guessing thats what you mean by CBO eating exceptions.
No, I am talking about how the code below does not nest the stack trace in
addition to not logging the stack trace or even the message. That is to say,
this code:
{noformat}
} catch (HiveException e) {
String logMsg = "Collecting stats failed.";
LOG.error(logMsg);
throw new RuntimeException(logMsg);
}
{noformat}
Should be:
{noformat}
} catch (HiveException e) {
String logMsg = "Collecting stats failed: " + e;
LOG.error(logMsg, e);
throw new RuntimeException(logMsg, e);
}
{noformat}
This code includes the exception class name and message in a single line which
is useful for operators who are often grepping large amount of logs:
{noformat}
String logMsg = "Collecting stats failed: " + e;
{noformat}
This message logs the stack trace in addition to the message:
{noformat}
LOG.error(logMsg, e);
{noformat}
This line nests the exception so the stack trace can be use at a higher level
where ever it's caught:
{noformat}
throw new RuntimeException(logMsg, e);
{noformat}
Alternatively since the exception should be logged at a higher level, you could
write as follows:
{noformat}
} catch (HiveException e) {
String msg = "Collecting stats failed: " + e;
throw new RuntimeException(msg, e);
}
{noformat}
> Many places in CBO code eat exceptions
> --------------------------------------
>
> Key: HIVE-9242
> URL: https://issues.apache.org/jira/browse/HIVE-9242
> Project: Hive
> Issue Type: Bug
> Reporter: Brock Noland
> Priority: Blocker
>
> I've noticed that there are a number of places in the CBO code which eat
> exceptions. This is not acceptable. Example:
> https://github.com/apache/hive/blob/357b473a354aace3bd59b522ad7108be561e9d0f/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/RelOptHiveTable.java#L274
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)