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

Samarth Jain commented on PHOENIX-2156:
---------------------------------------

Thanks for the patch, [~tdsilva]. Patch looks good for the most part. 

A few comments:

- Can you add a test where you are dropping multiple columns from the base 
table and then make sure all those columns are dropped from the views too.
- Drop multiple columns from the base table when there are multiple indexes on 
views. Some of those indexes have one or more of these columns being dropped.
- Would be good to have the above tests for multi-tenant tables and 
tenant-specific views too.

I know this is probably from existing code, but can you tell me when can a 
ClassNotFoundException be thrown here? Not sure if we should be really 
mentioning that in the method signature nor should we catch it.
{code}
private void dropIndexes(PTable table, HRegion region, List<ImmutableBytesPtr> 
invalidateList,
+            List<RowLock> locks, long clientTimeStamp, byte[] tenantId, byte[] 
schemaName,
+            byte[] tableName, List<Mutation> additionalTableMetaData, PColumn 
columnToDelete)
+            throws IOException, SQLException, ClassNotFoundException {
{code}

{code}
+                    // drop any view indexes that need this column
+                    try {
+                        dropIndexes(view, region, invalidateList, locks, 
clientTimeStamp, tenantId,
+                            schemaName, view.getName().getBytes(),
+                            mutationsForAddingColumnsToViews, 
existingViewColumn);
+                    } catch (ClassNotFoundException e) {
+                    }
{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.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