Gabriel39 commented on code in PR #14106:
URL: https://github.com/apache/doris/pull/14106#discussion_r1017482468
##########
docs/zh-CN/docs/ecosystem/udf/java-user-defined-function.md:
##########
@@ -74,16 +74,20 @@ PROPERTIES (["key"="value"][,...])
1. PROPERTIES中`symbol`表示的是包含UDF类的类名,这个参数是必须设定的。
2. PROPERTIES中`file`表示的包含用户UDF的jar包,这个参数是必须设定的。
3. PROPERTIES中`type`表示的 UDF 调用类型,默认为 Native,使用 Java UDF时传 JAVA_UDF。
-4. name:
一个function是要归属于某个DB的,name的形式为`dbName`.`funcName`。当`dbName`没有明确指定的时候,就是使用当前session所在的db作为`dbName`。
+4. PROPERTIES中`is_return_null`表示的 UDF 返回结果中是否有可能出现NULL值,可以设定为true或false。
Review Comment:
```suggestion
4. PROPERTIES中`always_nullable`表示的 UDF 返回结果中是否有可能出现NULL值,可以设定为true或false。
```
##########
fe/fe-core/src/main/java/org/apache/doris/analysis/CreateFunctionStmt.java:
##########
@@ -221,6 +228,19 @@ private void analyzeCommon(Analyzer analyzer) throws
AnalysisException {
throw new AnalysisException("library's checksum is not equal
with input, checksum=" + checksum);
}
}
+ if (binaryType == TFunctionBinaryType.JAVA_UDF) {
+ String returnNullModeStr = properties.get(IS_RETURN_NULL);
+ if (returnNullModeStr == null) {
Review Comment:
Make it optional and ALWAYS_NULLABLE by default
##########
fe/fe-core/src/main/java/org/apache/doris/analysis/CreateFunctionStmt.java:
##########
@@ -96,6 +97,8 @@ public class CreateFunctionStmt extends DdlStmt {
public static final String MERGE_METHOD_NAME = "merge";
public static final String GETVALUE_METHOD_NAME = "getValue";
public static final String STATE_CLASS_NAME = "State";
+ // add for java udf check return type nullable mode, always_nullable or
always_not_nullable
+ public static final String IS_RETURN_NULL = "is_return_null";
Review Comment:
```suggestion
public static final String IS_RETURN_NULL = "always_nullable";
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]