Indhumathi27 commented on a change in pull request #3653: [CARBONDATA-3665] 
Support TimeBased Cache expiration using ExpiringMap
URL: https://github.com/apache/carbondata/pull/3653#discussion_r392235005
 
 

 ##########
 File path: 
integration/spark/src/test/scala/org/apache/carbondata/sql/commands/TestCarbonShowCacheCommand.scala
 ##########
 @@ -288,4 +289,25 @@ class TestCarbonShowCacheCommand extends QueryTest with 
BeforeAndAfterAll {
     assert(showCache(0).get(2).toString.equalsIgnoreCase("5/5 index files 
cached"))
     sql("drop table if exists partitionTable")
   }
+
+  test("test cache expiration using expiringMap") {
+    sql("drop table if exists carbonTable")
+    sql("create table carbonTable(col1 int, col2 string,col3 string) stored as 
carbondata tblproperties('cache_expiration_time'='1')")
+    sql("insert into carbonTable select 1, 'ab', 'vf'")
+    sql("select count(*) from carbonTable").show(false)
+    var showCache = sql("show metacache on table carbonTable").collect()
+    assert(showCache(0).get(2).toString.equalsIgnoreCase("1/1 index files 
cached"))
+    Thread.sleep(60000)
+    showCache = sql("show metacache on table carbonTable").collect()
+    assert(showCache(0).get(2).toString.equalsIgnoreCase("0/1 index files 
cached"))
+  }
+
+  test("test cache expiration using expiringMap with invalid cache expiration 
time") {
+    sql("drop table if exists carbonTable")
+    intercept[MalformedCarbonCommandException] {
+      sql(
+        "create table carbonTable(col1 int, col2 string,col3 string) stored as 
carbondata tblproperties('cache_expiration_time'='ab')")
+    }.getMessage.contains("Invalid cache_expiration_time value found: ab")
+  }
 
 Review comment:
   added

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


With regards,
Apache Git Services

Reply via email to