maropu commented on a change in pull request #28852:
URL: https://github.com/apache/spark/pull/28852#discussion_r445885603



##########
File path: 
sql/hive/src/test/scala/org/apache/spark/sql/hive/HiveMetadataCacheSuite.scala
##########
@@ -126,4 +131,40 @@ class HiveMetadataCacheSuite extends QueryTest with 
SQLTestUtils with TestHiveSi
   for (pruningEnabled <- Seq(true, false)) {
     testCaching(pruningEnabled)
   }
+
+  test("expire cached metadata if TTL is configured") {
+    val sparkConfWithTTl = new SparkConf().set(SQLConf.METADATA_CACHE_TTL.key, 
"1")
+    val newSession = 
SparkSession.builder.config(sparkConfWithTTl).getOrCreate().cloneSession()
+
+    withSparkSession(newSession) { implicit spark =>
+      withTable("test_ttl") {
+        withTempDir { dir =>
+          spark.sql(s"""
+            |CREATE EXTERNAL TABLE test_ttl (id long)
+            |PARTITIONED BY (f1 int, f2 int)
+            |STORED AS PARQUET
+            |LOCATION "${dir.toURI}"""".stripMargin)

Review comment:
       nit format:
   ```
             spark.sql(
               s"""
                  |CREATE EXTERNAL TABLE test_ttl (id long)
                  |PARTITIONED BY (f1 int, f2 int)
                  |STORED AS PARQUET
                  |LOCATION "${dir.toURI}"
                """.stripMargin)
   ```




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

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