HIVE-14186: Display the exception message in MapReduce in beeline console (Aihua Xu, reviewed by Yongzhi Chen)
Project: http://git-wip-us.apache.org/repos/asf/hive/repo Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/662728fc Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/662728fc Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/662728fc Branch: refs/heads/hive-14535 Commit: 662728fce3ca31c3d1b27b16cf8a087f62deb578 Parents: c90eed2 Author: Aihua Xu <aihu...@apache.org> Authored: Fri Sep 16 11:45:34 2016 -0400 Committer: Aihua Xu <aihu...@apache.org> Committed: Mon Sep 19 10:52:32 2016 -0400 ---------------------------------------------------------------------- .../hadoop/hive/ql/exec/FunctionRegistry.java | 23 ++++++++------------ 1 file changed, 9 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hive/blob/662728fc/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java ---------------------------------------------------------------------- diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java index a854f9f..de74c3e 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java @@ -985,9 +985,6 @@ public final class FunctionRegistry { try { o = m.invoke(thisObject, arguments); } catch (Exception e) { - String thisObjectString = "" + thisObject + " of class " - + (thisObject == null ? "null" : thisObject.getClass().getName()); - StringBuilder argumentString = new StringBuilder(); if (arguments == null) { argumentString.append("null"); @@ -995,21 +992,19 @@ public final class FunctionRegistry { argumentString.append("{"); for (int i = 0; i < arguments.length; i++) { if (i > 0) { - argumentString.append(", "); - } - if (arguments[i] == null) { - argumentString.append("null"); - } else { - argumentString.append("" + arguments[i] + ":" - + arguments[i].getClass().getName()); + argumentString.append(","); } + + argumentString.append(arguments[i]); } - argumentString.append("} of size " + arguments.length); + argumentString.append("}"); } - throw new HiveException("Unable to execute method " + m + " " - + " on object " + thisObjectString + " with arguments " - + argumentString.toString(), e); + String detailedMsg = e instanceof java.lang.reflect.InvocationTargetException ? + e.getCause().getMessage() : e.getMessage(); + + throw new HiveException("Unable to execute method " + m + " with arguments " + + argumentString + ":" + detailedMsg, e); } return o; }