MaxGekk commented on a change in pull request #34852:
URL: https://github.com/apache/spark/pull/34852#discussion_r767438008



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/MiscFunctionsSuite.scala
##########
@@ -56,6 +57,23 @@ class MiscFunctionsSuite extends QueryTest with 
SharedSparkSession {
       assert(e.getMessage.contains("current_user"))
     }
   }
+
+  test("SPARK-37591: AES functions - GCM mode") {
+    Seq(
+      ("abcdefghijklmnop", ""),
+      ("abcdefghijklmnop", "abcdefghijklmnop"),
+      ("abcdefghijklmnop12345678", "Spark"),
+      ("abcdefghijklmnop12345678ABCDEFGH", "GCM mode")
+    ).foreach { case (key, input) =>
+      val df = Seq((key, input)).toDF("key", "input")
+      val encrypted = df.selectExpr("aes_encrypt(input, key, 'GCM', 'NONE') AS 
enc", "input", "key")
+      assert(encrypted.schema("enc").dataType === BinaryType)
+      assert(encrypted.filter($"enc" === $"input").isEmpty)
+      val result = encrypted.selectExpr(
+        "CAST(aes_decrypt(enc, key, 'GCM', 'NONE') AS STRING) AS res", "input")
+      assert(!result.filter($"res" === $"input").isEmpty)

Review comment:
       `DataFrameFunctionsSuite` has already had > 3800 lines. Don't think it 
makes sense to place new misc test there if there is a special test suite for 
such functions.




-- 
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: reviews-unsubscr...@spark.apache.org

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



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

Reply via email to