jpisaac commented on a change in pull request #799:
URL: https://github.com/apache/phoenix/pull/799#discussion_r446291104



##########
File path: phoenix-core/src/main/java/org/apache/phoenix/util/ViewUtil.java
##########
@@ -635,11 +639,52 @@ public static void 
addTagsToPutsForViewAlteredProperties(List<Mutation> tableMet
                         MetaDataEndpointImpl.VIEW_MODIFIED_PROPERTY_BYTES);
                 MetaDataUtil.conditionallyAddTagsToPutCells((Put)m,
                         PhoenixDatabaseMetaData.TABLE_FAMILY_BYTES,
-                        PhoenixDatabaseMetaData.VIEW_TTL_BYTES,
-                        parentViewTTLBytes,
+                        PhoenixDatabaseMetaData.PHOENIX_TTL_BYTES,
+                        parentPhoenixTTLBytes,
                         MetaDataEndpointImpl.VIEW_MODIFIED_PROPERTY_BYTES);
             }
 
         }
     }
+
+    public static ParseNode getViewWhereWithPhoenixTTL(StatementContext 
context, PTable table)
+            throws SQLException {
+        ParseNode viewWhere = null;
+        String viewStatement = null;
+
+        // If client side masking for PHOENIX_TTL is not enabled just return.
+        if (!ScanUtil.isClientSideMaskingEnabled(context.getConnection())) {
+            return viewWhere;
+        }
+
+        String viewTTLFilterClause = context.getConnection().getSCN() == null ?
+                String.format(
+                        "((TO_NUMBER(CURRENT_TIME()) - 
TO_NUMBER(phoenix_row_timestamp())) < %d)",
+                        table.getPhoenixTTL()) :
+                String.format(
+                "((%d - TO_NUMBER(phoenix_row_timestamp())) < %d)",
+                        context.getConnection().getSCN(), 
table.getPhoenixTTL());
+
+        if (table.getViewStatement() != null) {

Review comment:
       The getViewStatement will be "not null" in the case when "SELECT * FROM 
BASE_TABLE" and the processing should proceed.




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


Reply via email to