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

James Taylor commented on PHOENIX-3547:
---------------------------------------

You'd need to dip under the covers and run an UPSERT VALUES directly on the 
SYSTEM.CATALOG table to make this change since we don't support it in an ALTER 
TABLE call. You'd also need to (at upgrade time in 
ConnectionQueryServicesImpl.init()) write the rewrite the value for all 
existing rows. An alternative would be to detect at read time if the column 
value is only two bytes and read it as a short in that case in 
MetaDataEndPointImpl.getTable():
{code}
        Cell viewIndexIdKv = tableKeyValues[VIEW_INDEX_ID_INDEX];
        Short viewIndexId = viewIndexIdKv == null ? null : 
(Short)MetaDataUtil.getViewIndexIdDataType().getCodec().decodeShort(viewIndexIdKv.getValueArray(),
 viewIndexIdKv.getValueOffset(), SortOrder.getDefault());
{code}
As far as I can tell, it looks like VIEW_INDEX_ID is only read here and used 
during the construction of the PTable (object representation of the table 
metadata). 

> Promote CATALOG.VIEW_INDEX_ID to an int
> ---------------------------------------
>
>                 Key: PHOENIX-3547
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-3547
>             Project: Phoenix
>          Issue Type: New Feature
>            Reporter: Jeremy Huffman
>            Priority: Minor
>
> Increase the size of CATALOG.VIEW_INDEX_ID from smallint to int to support a 
> large number of indexed views on a single table.
> Per James: "The code would just need to be tolerant when reading the data if 
> the length is two byte short versus four byte int. At write time, we'd just 
> always write an int."
> See: 
> https://lists.apache.org/thread.html/22849e4fc73452cee3bea763cf6d5af7164dedcb44573ba6b9f452a2@%3Cuser.phoenix.apache.org%3E



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

Reply via email to