You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "Thomas D'Silva (JIRA)" <ji...@apache.org> on 2018/08/28 23:18:00 UTC

[jira] [Updated] (PHOENIX-4717) Document when a primary column is allowed to be added

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

Thomas D'Silva updated PHOENIX-4717:
------------------------------------
    Description: 
For both views and tables
1. We allow nullable columns in the PK, but only if they're variable length. Variable length types may be null, since we use a null-byte terminator (which is a disallowed character in variable length types). Fixed width types do not have a way of representing null.
There is the following TODO in PColumnImpl.init 
// TODO: we may be able to allow this for columns at the end of the PK

2. We disallow adding a column to the PK 
   a) if the last PK column is VARBINARY 
   b) if the last PK column is fixed width and nullable //not sure if this is possible currently because of #1
   c) if the column is not nullable (in order to handle existing rows)

For views:
1. We disallow adding a column to the PK If the last pk column is variable length
If the last pk column is variable length then we read all the bytes of the rowkey without looking for a separator byte so we cannot add a pk column to a view if the last pk column of the parent is variable length (see https://issues.apache.org/jira/browse/PHOENIX-978?focusedCommentId=14617847&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-14617847)






  was:We disallow adding a column to the PK if the last PK column is VARBINARY or if the last PK column is fixed width and nullable. 


> Document when a primary column is allowed to be added
> -----------------------------------------------------
>
>                 Key: PHOENIX-4717
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-4717
>             Project: Phoenix
>          Issue Type: Task
>            Reporter: Thomas D'Silva
>            Priority: Major
>
> For both views and tables
> 1. We allow nullable columns in the PK, but only if they're variable length. Variable length types may be null, since we use a null-byte terminator (which is a disallowed character in variable length types). Fixed width types do not have a way of representing null.
> There is the following TODO in PColumnImpl.init 
> // TODO: we may be able to allow this for columns at the end of the PK
> 2. We disallow adding a column to the PK 
>    a) if the last PK column is VARBINARY 
>    b) if the last PK column is fixed width and nullable //not sure if this is possible currently because of #1
>    c) if the column is not nullable (in order to handle existing rows)
> For views:
> 1. We disallow adding a column to the PK If the last pk column is variable length
> If the last pk column is variable length then we read all the bytes of the rowkey without looking for a separator byte so we cannot add a pk column to a view if the last pk column of the parent is variable length (see https://issues.apache.org/jira/browse/PHOENIX-978?focusedCommentId=14617847&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-14617847)



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