cambyzju commented on code in PR #40004:
URL: https://github.com/apache/doris/pull/40004#discussion_r1734744827


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/AesCryptoFunction.java:
##########
@@ -72,4 +82,17 @@ public static StringLiteral getDefaultBlockEncryptionMode() {
         }
         return encryptionMode;
     }
+
+    @Override
+    public void checkLegalityAfterRewrite() {
+        if (arity() >= 4 && child(3) instanceof StringLikeLiteral) {

Review Comment:
   @morrySnow 这个函数最多支持5个参数,不会超过5个。
   
   行为上这里确实很犹豫:
   当前现状:
   1、如果只输入两个参数,aes_encrypt(text, 
enc_key),会从session变量block_encryption_mode中,去获取模式,如果该模式不支持,则报错;
   2、如果输入4个参数时,aes_encrypt(text, enc_key,init_vector, 
mode),这时不会校验该模式是否支持,最终会生成null结果;
   这里显然,当输入4个参数时,应该校验模式是否支持,如果不支持则报错;但是如果这么改动,会导致行为变更。
   
   这个pr修改后:
   1、在新优化器分支,如果第四个参数是常量,则判断模式是否支持,不支持则报错;(修改)
   2、如果第四个参数不是常量,或者使用的是旧优化器,则不校验该模式是否支持,最终生成null结果;(维持)
   所以,综合来看,是不是干脆去掉这一段判断,维持之前的行为,可能更简单一点?



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