github-actions[bot] commented on code in PR #62698:
URL: https://github.com/apache/doris/pull/62698#discussion_r3238658658


##########
fe/fe-core/src/main/java/org/apache/doris/catalog/FunctionToSqlConverter.java:
##########
@@ -75,6 +75,13 @@ public static String toSql(ScalarFunction fn, boolean 
ifNotExists) {
                     .append("\"" + (fn.getLocation() == null ? "" : 
fn.getLocation().toString()) + "\"");
             boolean isReturnNull = fn.getNullableMode() == 
NullableMode.ALWAYS_NULLABLE;
             sb.append(",\n  \"ALWAYS_NULLABLE\"=").append("\"" + isReturnNull 
+ "\"");
+            sb.append(",\n  \"VOLATILITY\"=").append("\"" + 
fn.getVolatility().toSql() + "\"");
+        } else if (fn.getBinaryType() == Function.BinaryType.PYTHON_UDF) {
+            sb.append(",\n  \"FILE\"=")
+                    .append("\"" + (fn.getLocation() == null ? "" : 
fn.getLocation().toString()) + "\"");
+            boolean isReturnNull = fn.getNullableMode() == 
NullableMode.ALWAYS_NULLABLE;
+            sb.append(",\n  \"ALWAYS_NULLABLE\"=").append("\"" + isReturnNull 
+ "\"");
+            sb.append(",\n  \"VOLATILITY\"=").append("\"" + 
fn.getVolatility().toSql() + "\"");

Review Comment:
   This new Python-UDF serialization branch still emits an incomplete `CREATE 
FUNCTION`: `CreateFunctionCommand` requires `runtime_version` for every Python 
UDF, and inline Python UDFs also need the persisted `functionCode` emitted as 
the `AS $$...$$` body. For a function created like the new regression test 
(`CREATE FUNCTION py_vol_immutable ... "runtime_version"=... AS $$...$$`), 
`SHOW CREATE FUNCTION` will now return only `SYMBOL`, `FILE`, 
`ALWAYS_NULLABLE`, `VOLATILITY`, and `TYPE`, so replaying the shown SQL fails 
with `Python runtime version is not set` and loses the function body. Please 
include `RUNTIME_VERSION` and the inline code (or otherwise preserve file-based 
vs inline Python UDF properties) and add a replay-style test for `SHOW CREATE 
FUNCTION` on a Python UDF with volatility.



-- 
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]

Reply via email to