LuciferYang commented on code in PR #47543: URL: https://github.com/apache/spark/pull/47543#discussion_r1697852334
########## sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/orc/OrcEncryptionSuite.scala: ########## @@ -17,20 +17,53 @@ package org.apache.spark.sql.execution.datasources.orc +import java.lang.invoke.MethodHandles +import java.util.{Map => JMap} import java.util.Random -import org.apache.orc.impl.HadoopShimsFactory +import scala.collection.mutable +import org.apache.orc.impl.{CryptoUtils, HadoopShimsFactory, KeyProvider} + +import org.apache.spark.SparkConf import org.apache.spark.sql.Row import org.apache.spark.sql.test.SharedSparkSession class OrcEncryptionSuite extends OrcTest with SharedSparkSession { import testImplicits._ + override def sparkConf: SparkConf = { + super.sparkConf.set("spark.hadoop.hadoop.security.key.provider.path", "test:///") + } + + override def beforeAll(): Unit = { + // Backup `CryptoUtils#keyProviderCache` and clear it. + keyProviderCacheRef.entrySet() + .forEach(e => keyProviderCacheBackup.put(e.getKey, e.getValue)) + keyProviderCacheRef.clear() + super.beforeAll() + } + + override def afterAll(): Unit = { + super.afterAll() + // Restore `CryptoUtils#keyProviderCache`. + keyProviderCacheRef.clear() Review Comment: At this time, the content of `keyProviderCacheRef` might be ``` memory.java.security.SecureRandom -> org.apache.orc.InMemoryKeystore hadoop.java.security.SecureRandom -> org.apache.orc.impl.KeyProviderImpl ``` ![image](https://github.com/user-attachments/assets/e14d70e5-5936-480c-a715-32c466284ce6) -- 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