[Improvement](meta) update show create function result (#15414)
currently, show create function is designed for native function, it has some non suitable points. this pr bring several improvements, and make result of show create function can be used to create function. 1. add type property. 2. add ALWAYS_NULLABLE perperty for java_udf 3. use file property rather than object_file for java_udf, follow usage of create java_udf 4. remove md5 property, coz file may vary when create function again. 5. remove INIT_FN,UPDATE_FN,MERGE_FN,SERIALIZE_FN etc properties for java_udf, cos java_udf does not need these properties.
This commit is contained in:
@ -559,23 +559,32 @@ public class AggregateFunction extends Function {
|
||||
sb.append(" INTERMEDIATE " + getIntermediateType());
|
||||
}
|
||||
|
||||
sb.append(" PROPERTIES (")
|
||||
.append("\n \"INIT_FN\"=\"" + getInitFnSymbol() + "\"")
|
||||
.append(",\n \"UPDATE_FN\"=\"" + getUpdateFnSymbol() + "\"")
|
||||
.append(",\n \"MERGE_FN\"=\"" + getMergeFnSymbol() + "\"");
|
||||
if (getSerializeFnSymbol() != null) {
|
||||
sb.append(",\n \"SERIALIZE_FN\"=\"" + getSerializeFnSymbol() + "\"");
|
||||
}
|
||||
if (getFinalizeFnSymbol() != null) {
|
||||
sb.append(",\n \"FINALIZE_FN\"=\"" + getFinalizeFnSymbol() + "\"");
|
||||
sb.append(" PROPERTIES (");
|
||||
if (getBinaryType() != TFunctionBinaryType.JAVA_UDF) {
|
||||
sb.append("\n \"INIT_FN\"=\"" + getInitFnSymbol() + "\",")
|
||||
.append("\n \"UPDATE_FN\"=\"" + getUpdateFnSymbol() + "\",")
|
||||
.append("\n \"MERGE_FN\"=\"" + getMergeFnSymbol() + "\",");
|
||||
if (getSerializeFnSymbol() != null) {
|
||||
sb.append("\n \"SERIALIZE_FN\"=\"" + getSerializeFnSymbol() + "\",");
|
||||
}
|
||||
if (getFinalizeFnSymbol() != null) {
|
||||
sb.append("\n \"FINALIZE_FN\"=\"" + getFinalizeFnSymbol() + "\",");
|
||||
}
|
||||
}
|
||||
if (getSymbolName() != null) {
|
||||
sb.append(",\n \"SYMBOL\"=\"" + getSymbolName() + "\"");
|
||||
sb.append("\n \"SYMBOL\"=\"" + getSymbolName() + "\",");
|
||||
}
|
||||
|
||||
sb.append(",\n \"OBJECT_FILE\"=")
|
||||
.append("\"" + (getLocation() == null ? "" : getLocation().toString()) + "\"");
|
||||
sb.append(",\n \"MD5\"=").append("\"" + getChecksum() + "\"");
|
||||
if (getBinaryType() == TFunctionBinaryType.JAVA_UDF) {
|
||||
sb.append("\n \"FILE\"=")
|
||||
.append("\"" + (getLocation() == null ? "" : getLocation().toString()) + "\",");
|
||||
boolean isReturnNull = this.getNullableMode() == NullableMode.ALWAYS_NULLABLE;
|
||||
sb.append("\n \"ALWAYS_NULLABLE\"=").append("\"" + isReturnNull + "\",");
|
||||
} else {
|
||||
sb.append("\n \"OBJECT_FILE\"=")
|
||||
.append("\"" + (getLocation() == null ? "" : getLocation().toString()) + "\",");
|
||||
}
|
||||
sb.append("\n \"TYPE\"=").append("\"" + this.getBinaryType() + "\"");
|
||||
sb.append("\n);");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@ -389,9 +389,17 @@ public class ScalarFunction extends Function {
|
||||
if (getCloseFnSymbol() != null) {
|
||||
sb.append(",\n \"CLOSE_FN\"=").append("\"" + getCloseFnSymbol() + "\"");
|
||||
}
|
||||
sb.append(",\n \"OBJECT_FILE\"=")
|
||||
.append("\"" + (getLocation() == null ? "" : getLocation().toString()) + "\"");
|
||||
sb.append(",\n \"MD5\"=").append("\"" + getChecksum() + "\"");
|
||||
|
||||
if (getBinaryType() == TFunctionBinaryType.JAVA_UDF) {
|
||||
sb.append(",\n \"FILE\"=")
|
||||
.append("\"" + (getLocation() == null ? "" : getLocation().toString()) + "\"");
|
||||
boolean isReturnNull = this.getNullableMode() == NullableMode.ALWAYS_NULLABLE;
|
||||
sb.append(",\n \"ALWAYS_NULLABLE\"=").append("\"" + isReturnNull + "\"");
|
||||
} else {
|
||||
sb.append(",\n \"OBJECT_FILE\"=")
|
||||
.append("\"" + (getLocation() == null ? "" : getLocation().toString()) + "\"");
|
||||
}
|
||||
sb.append(",\n \"TYPE\"=").append("\"" + this.getBinaryType() + "\"");
|
||||
sb.append("\n);");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user