morrySnow commented on code in PR #17907:
URL: https://github.com/apache/doris/pull/17907#discussion_r1149253373


##########
fe/fe-core/src/main/java/org/apache/doris/catalog/BuiltinScalarFunctions.java:
##########
@@ -574,6 +580,8 @@ public class BuiltinScalarFunctions implements 
FunctionHelper {
             scalar(Sm3sum.class, "sm3sum"),
             scalar(Sm4Decrypt.class, "sm4_decrypt"),
             scalar(Sm4Encrypt.class, "sm4_encrypt"),
+            scalar(Sm4DecryptV2.class, "sm4_decrypt_v2"),
+            scalar(Sm4EncryptV2.class, "sm4_encrypt_v2"),

Review Comment:
   please add function in the order of alphabet



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/AesDecryptV2.java:
##########
@@ -0,0 +1,77 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.nereids.trees.expressions.functions.scalar;
+
+import org.apache.doris.nereids.exceptions.AnalysisException;
+import org.apache.doris.nereids.trees.expressions.Expression;
+import org.apache.doris.nereids.trees.expressions.literal.StringLiteral;
+import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor;
+
+import com.google.common.base.Preconditions;
+
+import java.util.List;
+
+/**
+ * ScalarFunction 'aes_decrypt'. This class is generated by GenerateFunction.
+ */
+public class AesDecryptV2 extends AesDecrypt {
+
+    /**
+     * AesDecryptV2
+     */
+    public AesDecryptV2(Expression arg0, Expression arg1) {
+        super(arg0, arg1, getDefaultBlockEncryptionMode());
+        String blockEncryptionMode = 
String.valueOf(getDefaultBlockEncryptionMode());
+        if (!blockEncryptionMode.toUpperCase().equals("'AES_128_ECB'")
+                && !blockEncryptionMode.toUpperCase().equals("'AES_192_ECB'")
+                && !blockEncryptionMode.toUpperCase().equals("'AES_256_ECB'")) 
{
+            throw new AnalysisException("Incorrect parameter count in the call 
to native function 'aes_decrypt'");
+        }
+    }
+
+    public AesDecryptV2(Expression arg0, Expression arg1, Expression arg2) {
+        super(arg0, arg1, arg2);
+    }
+
+    public AesDecryptV2(Expression arg0, Expression arg1, Expression arg2, 
Expression arg3) {
+        super(arg0, arg1, arg2, arg3);
+    }
+
+    /**
+     * withChildren.
+     */
+    @Override
+    public AesDecryptV2 withChildren(List<Expression> children) {
+        Preconditions.checkArgument(children.size() >= 2 && children.size() <= 
4);
+        if (children.size() == 2) {
+            return new AesDecryptV2(children.get(0), children.get(1));
+        } else if (children().size() == 3) {
+            return new AesDecryptV2(children.get(0), children.get(1), 
children.get(2));
+        } else {
+            if (!(children.get(3) instanceof StringLiteral)) {
+                throw new AnalysisException("the 4th parameter should be 
string literal: " + this.toSql());
+            }

Review Comment:
   should not add check here, the fourth child should be string type or varchar 
type, but maybe not string literal. signature already check the type, so remove 
this check please. 



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to