[ 
https://issues.apache.org/jira/browse/PHOENIX-1367?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15457261#comment-15457261
 ] 

James Taylor commented on PHOENIX-1367:
---------------------------------------

Thanks for the patch, [~tdsilva]. The initial part of the patch looks as 
expected. This should already be recursive, in that this updateCache call will 
in turn go through addIndexesFromParentTable until you reach the physical table.
{code}
+        // a view on a table will not have a parent name but will have a 
physical table name (which is the parent)
+        String parentName = view.getParentName()!=null ? 
view.getParentName().getString() : view.getPhysicalName().getString();
+        String schemaName = SchemaUtil.getSchemaNameFromFullName(parentName);
+        String tableName = SchemaUtil.getTableNameFromFullName(parentName);
+        MetaDataMutationResult parentResult = 
updateCache(connection.getTenantId(), schemaName, tableName, false, 
resolvedTimestamp);
{code}

At the deepest level of the recursion, you should have the physical table and 
view1. This should just work as it did before (ignoring bugs, which of course 
there might be). Once this returns, then you'd have view1 as the parent table 
and view2 as the child. I'm hoping the routine just does the right thing. The 
part of the patch that catches the ColumnNotFoundException and checks if 
indexParentTable==null doesn't seem right (or I don't understand it). Let's sit 
together and look closer. You might need to re-resolve view1 because it would 
have been changed during the recursive call (but not sure if that's important 
or not).

Essentially, you want to add the indexes from the parent table/view to each 
child view, all the way up the view hierarchy.

> VIEW derived from another VIEW doesn't use parent VIEW indexes
> --------------------------------------------------------------
>
>                 Key: PHOENIX-1367
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-1367
>             Project: Phoenix
>          Issue Type: Sub-task
>            Reporter: James Taylor
>            Assignee: Thomas D'Silva
>             Fix For: 4.9.0, 4.8.1
>
>         Attachments: PHOENIX-1369-4.x-HBase-0.98.patch, 
> PHOENIX_1367.test.patch
>
>
> If a VIEW has an index and another VIEW is derived from it, the child view 
> will not use the parent view's indexes.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to