This is an automated email from the ASF dual-hosted git repository.
zhangstar333 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new aef162ad4c [test](log) add some log in udf function when thrown
exception (#23651)
aef162ad4c is described below
commit aef162ad4cc89c8db9d1815972f6935f219fde6d
Author: zhangstar333 <[email protected]>
AuthorDate: Wed Aug 30 14:16:05 2023 +0800
[test](log) add some log in udf function when thrown exception (#23651)
[test](log) add some log in udf function when thrown exception (#23651)
---
.../java/org/apache/doris/udf/BaseExecutor.java | 28 ++++++++++++++++++++++
.../java/org/apache/doris/udf/UdafExecutor.java | 6 +++++
.../java/org/apache/doris/udf/UdfExecutor.java | 1 +
3 files changed, 35 insertions(+)
diff --git
a/fe/be-java-extensions/java-udf/src/main/java/org/apache/doris/udf/BaseExecutor.java
b/fe/be-java-extensions/java-udf/src/main/java/org/apache/doris/udf/BaseExecutor.java
index 20f36866c8..41dfe04c2a 100644
---
a/fe/be-java-extensions/java-udf/src/main/java/org/apache/doris/udf/BaseExecutor.java
+++
b/fe/be-java-extensions/java-udf/src/main/java/org/apache/doris/udf/BaseExecutor.java
@@ -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;
diff --git
a/fe/be-java-extensions/java-udf/src/main/java/org/apache/doris/udf/UdafExecutor.java
b/fe/be-java-extensions/java-udf/src/main/java/org/apache/doris/udf/UdafExecutor.java
index fa19ad3288..bb397f689a 100644
---
a/fe/be-java-extensions/java-udf/src/main/java/org/apache/doris/udf/UdafExecutor.java
+++
b/fe/be-java-extensions/java-udf/src/main/java/org/apache/doris/udf/UdafExecutor.java
@@ -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);
}
diff --git
a/fe/be-java-extensions/java-udf/src/main/java/org/apache/doris/udf/UdfExecutor.java
b/fe/be-java-extensions/java-udf/src/main/java/org/apache/doris/udf/UdfExecutor.java
index a77b441b67..55a7ef89ea 100644
---
a/fe/be-java-extensions/java-udf/src/main/java/org/apache/doris/udf/UdfExecutor.java
+++
b/fe/be-java-extensions/java-udf/src/main/java/org/apache/doris/udf/UdfExecutor.java
@@ -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);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]