[ 
https://issues.apache.org/jira/browse/PHOENIX-2156?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Thomas D'Silva updated PHOENIX-2156:
------------------------------------
    Attachment: PHOENIX-2156-v3.patch

[~jamestaylor]

Thanks for the review. I modified the code to return the tables being dropped 
that are not stored in a shared physical table. I also returned a list of 
shared physical tables to the the client so that the index rows can be deleted 
from the client. 
I also refactored dropColumnsFromChildViews and addRowsToChildViews to pull out 
common code into updateViewHeaderRow. 

In Metadataclient dropColumn we weren't deleting the covered column of the 
index if the column was being dropped from the base table so I fixed this also.
 
{code}
                         else if (coveredColumns.contains(columnToDropRef)) {
                             String indexColumnName = 
IndexUtil.getIndexColumnName(columnToDrop);
-                            
indexColumnsToDrop.add(index.getColumn(indexColumnName));
+                            PColumn indexColumn = 
index.getColumn(indexColumnName);
+                            indexColumnsToDrop.add(indexColumn);
+                            // add the index column to be dropped so that we 
actually delete the column values
+                            columnsToDrop.add(new ColumnRef(new 
TableRef(index), indexColumn.getPosition()));
                         }
{code}


> Support drop of column from table with views
> --------------------------------------------
>
>                 Key: PHOENIX-2156
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-2156
>             Project: Phoenix
>          Issue Type: Sub-task
>            Reporter: James Taylor
>            Assignee: Thomas D'Silva
>             Fix For: 4.8.0
>
>         Attachments: PHOENIX-2156-v2.patch, PHOENIX-2156-v3.patch, 
> PHOENIX-2156.patch
>
>
> Much like PHOENIX-1504 allows a column to be added to a base view, we should 
> support dropping a column from a table that has views as well. These seems 
> like a simpler problem: you just need to query for all views with a 
> BASE_COLUMN_COUNT < dropped_column_ordinal_pos, decrement the ordinal 
> positions of columns after that, and drop indexes that reference the column 
> being dropped.



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

Reply via email to