jpisaac commented on code in PR #2130:
URL: https://github.com/apache/phoenix/pull/2130#discussion_r2080206128


##########
phoenix-core-client/src/main/java/org/apache/phoenix/util/MetaDataUtil.java:
##########
@@ -1190,4 +1197,46 @@ public static boolean avoidMetadataRPC(PhoenixConnection 
connection, PTable tabl
                 connection.getMetaDataCache().getAge(tableRef) <
                         effectiveUpdateCacheFreq;
     }
+
+
+    public static TTLExpression convertForeverAndNoneTTLValue(Object 
propValue, boolean forSystemCatalog) {
+        //Handle FOREVER and NONE value for TTL at HBase level TTL.
+        if (propValue == null) {
+            return forSystemCatalog ? TTL_EXPRESSION_NOT_DEFINED : 
TTL_EXPRESSION_FOREVER;
+        }
+        if (propValue instanceof String) {
+            String strValue = (String) propValue;
+            if ("FOREVER".equalsIgnoreCase(strValue) || 
"NONE".equalsIgnoreCase(strValue) || "0".equalsIgnoreCase(strValue)) {
+                propValue = forSystemCatalog ? TTL_NOT_DEFINED : 
HConstants.FOREVER;
+            }
+        } else if (propValue instanceof Integer && 
propValue.equals(TTL_NOT_DEFINED)) {
+            propValue = forSystemCatalog ? TTL_NOT_DEFINED : 
HConstants.FOREVER;
+        }
+        return (TTLExpression) TableProperty.TTL.getValue(propValue);
+    }
+
+    /**
+     * In 5.3.0 release the TTL column will be created in SYSTEM.CATALOG and 
used to store TTL values,
+     * but the TTL values for tables with literal expressions will continue to 
be stored in
+     * the HBase TableDescriptor for backward compatibility.
+     * When table type != TABLE (i.e. VIEW TTL) OR expression is 
ConditionalExpression then
+     * actual TTL value is stored in SYSTEM.CATALOG and TableDescriptor will 
be set to FOREVER
+     * When table type == TABLE (i.e. Table TTL) and expression is 
LiteralExpression then
+     * actual TTL value is stored in TableDescriptor
+     * and SYSTEM.CATALOG will be set to 
TTL_EXPRESSION_DEFINED_IN_TABLE_DESCRIPTOR.
+     * if expression == TTL_NOT_DEFINED OR FOREVER then
+     * TTL_NOT_DEFINED will be stores in SYSTEM.CATALOG
+     */
+    public static TTLExpression getCompatibleTTLExpression(TTLExpression 
expression, PTableType tableType) {
+        TTLExpression ttl;

Review Comment:
   Check for other table types



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

Reply via email to