This is an automated email from the ASF dual-hosted git repository.

dataroaring pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new 1fdf36aeb51 branch-3.0: [fix](serDe) global function could not 
deserialization from image #50279 (#50347)
1fdf36aeb51 is described below

commit 1fdf36aeb51de8224215a5e88e06a32c17351eb9
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Thu Apr 24 19:41:39 2025 +0800

    branch-3.0: [fix](serDe) global function could not deserialization from 
image #50279 (#50347)
    
    Cherry-picked from #50279
    
    Co-authored-by: morrySnow <[email protected]>
---
 .../main/java/org/apache/doris/catalog/GlobalFunctionMgr.java  |  2 +-
 .../org/apache/doris/nereids/trees/expressions/UdfTest.java    | 10 +++++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/catalog/GlobalFunctionMgr.java 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/GlobalFunctionMgr.java
index fbb8a525a36..2e3f81d93ee 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/GlobalFunctionMgr.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/GlobalFunctionMgr.java
@@ -61,7 +61,7 @@ public class GlobalFunctionMgr extends MetaObject implements 
GsonPostProcessable
     @Override
     public void write(DataOutput out) throws IOException {
         // write functions
-        Text.writeString(out, GsonUtils.GSON.toJson(name2Function));
+        Text.writeString(out, GsonUtils.GSON.toJson(this, 
GlobalFunctionMgr.class));
     }
 
     @Override
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/UdfTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/UdfTest.java
index 635a3300dfe..39fd3a22336 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/UdfTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/UdfTest.java
@@ -18,6 +18,8 @@
 package org.apache.doris.nereids.trees.expressions;
 
 import org.apache.doris.catalog.Env;
+import org.apache.doris.catalog.Function;
+import org.apache.doris.catalog.GlobalFunctionMgr;
 import org.apache.doris.common.Config;
 import org.apache.doris.nereids.trees.expressions.functions.scalar.DateFormat;
 import org.apache.doris.nereids.trees.expressions.functions.scalar.DateTrunc;
@@ -49,6 +51,7 @@ import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.DataInputStream;
 import java.io.DataOutputStream;
+import java.util.List;
 
 public class UdfTest extends TestWithFeService implements 
PlanPatternMatchSupported {
     @Override
@@ -192,8 +195,13 @@ public class UdfTest extends TestWithFeService implements 
PlanPatternMatchSuppor
         Env.getCurrentEnv().getGlobalFunctionMgr().write(new 
DataOutputStream(outputStream));
         byte[] buffer = outputStream.toByteArray();
         ByteArrayInputStream inputStream = new ByteArrayInputStream(buffer);
-        Env.getCurrentEnv().getGlobalFunctionMgr().readFields(new 
DataInputStream(inputStream));
+        GlobalFunctionMgr newMgr = GlobalFunctionMgr.read(new 
DataInputStream(inputStream));
 
+        List<Function> functions = newMgr.getFunctions();
+        Assertions.assertEquals(1, functions.stream()
+                .map(f -> f.getFunctionName().getFunction())
+                .filter(name -> name.equals("f8"))
+                .count());
         Assertions.assertEquals(1, Env.getCurrentEnv().getFunctionRegistry()
                 .findUdfBuilder(connectContext.getDatabase(), "f8").size());
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to