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

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

Why is this part of the patch necessary?
{code}
-                    } catch (ColumnNotFoundException e) { // Ignore this index 
and continue with others
-                        containsAllReqdCols = false;
+                    } catch (ColumnNotFoundException e1) { 
+                        // check if the index is on a view and if so check if 
the column is present and is a view constant
+                        if (indexParentTable==null) {
+                            parentName = index.getParentName().getString();
+                            schemaName = 
SchemaUtil.getSchemaNameFromFullName(parentName);
+                            tableName = 
SchemaUtil.getTableNameFromFullName(parentName);
+                            parentResult = updateCache(null, schemaName, 
tableName, false, resolvedTimestamp);
+                            parentTable = parentResult.getTable();
+                            if (parentTable != null && 
parentTable.getViewType()!=null) 
+                                indexParentTable = parentTable;
+                        }
+                        if (indexParentTable!=null) {
+                            PColumn indexCol = null;
+                            try {
+                                String cf = col.getFamilyName()!=null ? 
col.getFamilyName().getString() : null;
+                                String cq = col.getName().getString();
+                                if (cf!=null) {
+                                    indexCol = 
indexParentTable.getColumnFamily(cf).getColumn(cq);
+                                }
+                                else {
+                                    indexCol = indexParentTable.getColumn(cq);
+                                }
+                            } catch (ColumnNotFoundException e2) { // Ignore 
this index and continue with others
+                                containsAllReqdCols = false;
+                                break;
+                            }
+                            if (indexCol.getViewConstant()==null || 
Bytes.compareTo(indexCol.getViewConstant(), col.getViewConstant())!=0) {
+                                containsAllReqdCols = false;
+                                break;
+                            }
+                        }
+                        else {
+                            // Ignore this index and continue with others
+                            containsAllReqdCols = false;
+                        }
{code}

> 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-v2.patch, 
> 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