Add FE constant folding for ord and unicode functions

Co-authored-by: zclllyybb <61408379+zclllyybb@users.noreply.github.com>
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java
index 0172c3b..9ea834b 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java
@@ -418,6 +418,30 @@
     }
 
     /**
+     * Executable arithmetic functions Ord
+     * Returns the Unicode code point of the first character.
+     */
+    @ExecFunction(name = "ord")
+    public static Expression ord(StringLikeLiteral first) {
+        String value = first.getValue();
+        if (value.isEmpty()) {
+            return new BigIntLiteral(0L);
+        }
+        // Get the Unicode code point of the first character
+        int codePoint = value.codePointAt(0);
+        return new BigIntLiteral((long) codePoint);
+    }
+
+    /**
+     * Executable arithmetic functions Unicode (alias for ord)
+     * Returns the Unicode code point of the first character.
+     */
+    @ExecFunction(name = "unicode")
+    public static Expression unicode(StringLikeLiteral first) {
+        return ord(first);
+    }
+
+    /**
      * Executable arithmetic functions Bin
      */
     @ExecFunction(name = "bin")
diff --git a/regression-test/suites/nereids_p0/expression/fold_constant/fold_constant_string_arithmatic.groovy b/regression-test/suites/nereids_p0/expression/fold_constant/fold_constant_string_arithmatic.groovy
index 88863da..0c1259f 100644
--- a/regression-test/suites/nereids_p0/expression/fold_constant/fold_constant_string_arithmatic.groovy
+++ b/regression-test/suites/nereids_p0/expression/fold_constant/fold_constant_string_arithmatic.groovy
@@ -65,6 +65,23 @@
     testFoldConst("select ascii('')")
     testFoldConst("select ascii('中')")
 
+    // ord (returns Unicode code point of first character)
+    testFoldConst("select ord('A')")
+    testFoldConst("select ord('a')")
+    testFoldConst("select ord('1')")
+    testFoldConst("select ord('!')")
+    testFoldConst("select ord('')")
+    testFoldConst("select ord('hello')")
+    testFoldConst("select ord('中')")
+    testFoldConst("select ord('你好')")
+    testFoldConst("select ord('こ')")
+    testFoldConst("select ord('😀')")
+
+    // unicode (alias for ord)
+    testFoldConst("select unicode('A')")
+    testFoldConst("select unicode('中')")
+    testFoldConst("select unicode('😀')")
+
     // bin
     testFoldConst("select bin(5)")
     testFoldConst("select bin(-5)")