You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by "Swaroopa Kadam (JIRA)" <ji...@apache.org> on 2019/05/08 23:37:00 UTC

[jira] [Commented] (PHOENIX-5261) Implement ALTER TABLE ADD COLUMN CASCADE

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

Swaroopa Kadam commented on PHOENIX-5261:
-----------------------------------------

Answering the outstanding questions:

I checked against 4.x branch, after a small PoC:

(Phoenix doesn't allow creating a view with a subset of columns)

1. Does splittable system catalog already take care of Item 1? *Yes*

2. What about tenant-owned views? *Yes* 

3. Should there be a way to exclude adding the column to a child index to allow for uncovered usage?

Seems a fair ask; we can have a grammar like below: 
{code:java}
ALTER TABLE ADD COLUMN CASCADE <comma spearated list of indexes | ALL > IF NOT EXISTS <column references>
{code}
 

> Implement ALTER TABLE ADD COLUMN CASCADE
> ----------------------------------------
>
>                 Key: PHOENIX-5261
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-5261
>             Project: Phoenix
>          Issue Type: Improvement
>            Reporter: Geoffrey Jacoby
>            Assignee: Swaroopa Kadam
>            Priority: Major
>
> Phoenix currently gives no way to alter the columns in an index. This is because adding a column to an index would require a full rebuild to cycle through the parent table and add the values to the index. 
> There is a special case, however, when adding a column to an index would be very useful and easy, and that is when adding a new nullable field to the index's parent table. In this case it is safe to just go ahead and add the column to the index, because at DDL time the field is known to be NULL on each row. 
> I propose adding an optional parameter CASCADE to ALTER TABLE ADD COLUMN, which when used will do the following:
> 1. The new column will be automatically added to any child views.
> 2. The new column will be automatically added as an INCLUDED column in any secondary index belonging to the parent table. 
> Outstanding questions:
> 1. Does splittable system catalog already take care of Item 1?
> 2. What about tenant-owned views?
> 3. Should there be a way to exclude adding the column to a child index to allow for uncovered usage?  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)