[test](log) add some log in udf function when thrown exception (#23651)
[test](log) add some log in udf function when thrown exception (#23651)
This commit is contained in:
@ -100,6 +100,34 @@ public abstract class BaseExecutor {
|
||||
init(request, jarFile, funcRetType, parameterTypes);
|
||||
}
|
||||
|
||||
public String debugString() {
|
||||
String res = "";
|
||||
for (JavaUdfDataType type : argTypes) {
|
||||
res = res + type.toString();
|
||||
if (type.getItemType() != null) {
|
||||
res = res + " item: " + type.getItemType().toString() + " sql: " + type.getItemType().toSql();
|
||||
}
|
||||
if (type.getKeyType() != null) {
|
||||
res = res + " key: " + type.getKeyType().toString() + " sql: " + type.getKeyType().toSql();
|
||||
}
|
||||
if (type.getValueType() != null) {
|
||||
res = res + " key: " + type.getValueType().toString() + " sql: " + type.getValueType().toSql();
|
||||
}
|
||||
}
|
||||
res = res + " return type: " + retType.toString();
|
||||
if (retType.getItemType() != null) {
|
||||
res = res + " item: " + retType.getItemType().toString() + " sql: " + retType.getItemType().toSql();
|
||||
}
|
||||
if (retType.getKeyType() != null) {
|
||||
res = res + " key: " + retType.getKeyType().toString() + " sql: " + retType.getKeyType().toSql();
|
||||
}
|
||||
if (retType.getValueType() != null) {
|
||||
res = res + " key: " + retType.getValueType().toString() + " sql: " + retType.getValueType().toSql();
|
||||
}
|
||||
res = res + " methodAccess: " + methodAccess.toString();
|
||||
return res;
|
||||
}
|
||||
|
||||
protected abstract void init(TJavaUdfExecutorCtorParams request, String jarPath,
|
||||
Type funcRetType, Type... parameterTypes) throws UdfRuntimeException;
|
||||
|
||||
|
||||
@ -126,6 +126,7 @@ public class UdafExecutor extends BaseExecutor {
|
||||
methodAccess.invoke(udf, addIndex, inputArgs);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOG.info("evaluate exception debug: " + debugString());
|
||||
LOG.info("invoke add function meet some error: " + e.getCause().toString());
|
||||
throw new UdfRuntimeException("UDAF failed to addBatchSingle: ", e);
|
||||
}
|
||||
@ -158,6 +159,7 @@ public class UdafExecutor extends BaseExecutor {
|
||||
methodAccess.invoke(udf, addIndex, inputArgs);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOG.info("evaluate exception debug: " + debugString());
|
||||
LOG.info("invoke add function meet some error: " + Arrays.toString(e.getStackTrace()));
|
||||
throw new UdfRuntimeException("UDAF failed to addBatchPlaces: ", e);
|
||||
}
|
||||
@ -202,6 +204,7 @@ public class UdafExecutor extends BaseExecutor {
|
||||
allMethods.get(UDAF_SERIALIZE_FUNCTION).invoke(udf, args);
|
||||
return baos.toByteArray();
|
||||
} catch (Exception e) {
|
||||
LOG.info("evaluate exception debug: " + debugString());
|
||||
LOG.warn("invoke serialize function meet some error: " + e.getCause().toString());
|
||||
throw new UdfRuntimeException("UDAF failed to serialize: ", e);
|
||||
}
|
||||
@ -219,6 +222,7 @@ public class UdafExecutor extends BaseExecutor {
|
||||
}
|
||||
allMethods.get(UDAF_RESET_FUNCTION).invoke(udf, args);
|
||||
} catch (Exception e) {
|
||||
LOG.info("evaluate exception debug: " + debugString());
|
||||
LOG.warn("invoke reset function meet some error: " + e.getCause().toString());
|
||||
throw new UdfRuntimeException("UDAF failed to reset: ", e);
|
||||
}
|
||||
@ -247,6 +251,7 @@ public class UdafExecutor extends BaseExecutor {
|
||||
}
|
||||
allMethods.get(UDAF_MERGE_FUNCTION).invoke(udf, args);
|
||||
} catch (Exception e) {
|
||||
LOG.info("evaluate exception debug: " + debugString());
|
||||
LOG.warn("invoke merge function meet some error: " + e.getCause().toString());
|
||||
throw new UdfRuntimeException("UDAF failed to merge: ", e);
|
||||
}
|
||||
@ -263,6 +268,7 @@ public class UdafExecutor extends BaseExecutor {
|
||||
}
|
||||
return allMethods.get(UDAF_RESULT_FUNCTION).invoke(udf, stateObjMap.get((Long) place));
|
||||
} catch (Exception e) {
|
||||
LOG.info("evaluate exception debug: " + debugString());
|
||||
LOG.warn("invoke getValue function meet some error: " + e.getCause().toString());
|
||||
throw new UdfRuntimeException("UDAF failed to result", e);
|
||||
}
|
||||
|
||||
@ -115,6 +115,7 @@ public class UdfExecutor extends BaseExecutor {
|
||||
}
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
LOG.info("evaluate exception: " + debugString());
|
||||
LOG.info("evaluate(int numRows, Object[] column) Exception: " + e.toString());
|
||||
throw new UdfRuntimeException("UDF failed to evaluate", e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user