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_r392235156
##########
File path:
integration/spark/src/main/scala/org/apache/carbondata/spark/util/CommonUtil.scala
##########
@@ -416,6 +416,31 @@ object CommonUtil {
}
}
+ /**
+ * This method will validate the cache expiration time specified by the user
+ *
+ * @param tableProperties table property specified by user
+ * @param propertyName property name
+ */
+ def validateCacheExpiration(tableProperties: Map[String, String],
propertyName: String): Unit = {
+ var expirationTime: java.lang.Long = 0L
+ if (tableProperties.get(propertyName).isDefined) {
+ val value = tableProperties(propertyName)
+ val exceptionMsg = s"Invalid $propertyName value found: " +
+ s"$value, only duration from 1 minute to 1440 minutes
is supported."
+ try {
+ expirationTime = java.lang.Long.parseLong(value)
+ } catch {
+ case n: NumberFormatException =>
+ throw new MalformedCarbonCommandException(exceptionMsg)
+ }
+ if (expirationTime == 0L) {
+ throw new MalformedCarbonCommandException(exceptionMsg)
+ }
+ tableProperties.put(propertyName, value)
Review comment:
done
----------------------------------------------------------------
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