Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/10527#discussion_r51355182
  
    --- Diff: 
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/MiscFunctionsSuite.scala
 ---
    @@ -132,4 +132,49 @@ class MiscFunctionsSuite extends SparkFunSuite with 
ExpressionEvalHelper {
           }
         }
       }
    +
    +  test("aesEncrypt") {
    +    checkEvaluation(Base64(AesEncrypt(Literal("ABC".getBytes),
    +      Literal("1234567890123456".getBytes))), "y6Ss+zCYObpCbgfWfyNWTw==")
    +    checkEvaluation(Base64(AesEncrypt(Literal("".getBytes),
    +      Literal("1234567890123456".getBytes))), "BQGHoM3lqYcsurCRq3PlUw==")
    +
    +    // input is null
    +    checkEvaluation(AesEncrypt(Literal.create(null, BinaryType),
    +      Literal("1234567890123456".getBytes)), null)
    +    // key length (80 bits) is not one of the permitted values (128, 192 
or 256 bits)
    +    checkEvaluation(Base64(AesEncrypt(Literal("ABC".getBytes),
    +      Literal("1234567890".getBytes))), null)
    +    // key is null
    +    checkEvaluation(Base64(AesEncrypt(Literal("ABC".getBytes),
    +      Literal.create(null, BinaryType))), null)
    +    // both are null
    +    checkEvaluation(Base64(AesEncrypt(Literal.create(null, BinaryType),
    +      Literal.create(null, BinaryType))), null)
    +  }
    +
    +  test("aesDecrypt") {
    +    
checkEvaluation(AesDecrypt(UnBase64(Literal("y6Ss+zCYObpCbgfWfyNWTw==")),
    +      Literal("1234567890123456".getBytes)), "ABC")
    +    
checkEvaluation(AesDecrypt(UnBase64(Literal("BQGHoM3lqYcsurCRq3PlUw==")),
    +      Literal("1234567890123456".getBytes)), "")
    +
    +    // input is null
    +    checkEvaluation(AesDecrypt(UnBase64(Literal.create(null, StringType)),
    +      Literal("1234567890123456".getBytes)), null)
    +    // key length (80 bits) is not one of the permitted values (128, 192 
or 256 bits)
    +    
checkEvaluation(AesDecrypt(UnBase64(Literal("y6Ss+zCYObpCbgfWfyNWTw==")),
    +      Literal("1234567890".getBytes)), null)
    +    // key is null
    +    
checkEvaluation(AesDecrypt(UnBase64(Literal("y6Ss+zCYObpCbgfWfyNWTw==")),
    +      Literal.create(null, BinaryType)), null)
    +    // both are null
    +    checkEvaluation(AesDecrypt(UnBase64(Literal.create(null, StringType)),
    +      Literal.create(null, BinaryType)), null)
    +  }
    +
    +  ignore("aesEncryptWith256bitsKey") {
    --- End diff --
    
    please add a comment to explain why we ignore it.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to