MaxGekk commented on a change in pull request #34852:
URL: https://github.com/apache/spark/pull/34852#discussion_r767432344
##########
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:
I would rather move other tests for misc functions from
`DataFrameFunctionsSuite` to the dedicated `MiscFunctionsSuite`. I was thinking
of moving all AES related tests here but decided to don't do unrelated changes.
--
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]