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

ASF GitHub Bot commented on PHOENIX-1673:
-----------------------------------------

Github user JamesRTaylor commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/104#discussion_r36442703
  
    --- Diff: phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java 
---
    @@ -657,6 +660,22 @@ public static PName 
padTenantIdIfNecessary(RowKeySchema schema, boolean isSalted
             return tenantId;
         }
     
    +    public static byte[] getTenantIdBytes(RowKeySchema schema, boolean 
isSalted, PName tenantId)
    +            throws SQLException {
    +        int pkPos = isSalted ? 1 : 0;
    +        Field field = schema.getField(pkPos);
    +        PDataType dataType = field.getDataType();
    +        byte[] convertedValue;
    +        try {
    +            Object value = dataType.toObject(tenantId.getString());
    --- End diff --
    
    For this dataType.toBytes() call, use the one that accepts sortOrder so 
that it'll still work if the tenantId column is descending:
    
        convertedValue = dataType.toBytes(value, field.getSortOrder());


> Allow tenant ID to be of any integral data type
> -----------------------------------------------
>
>                 Key: PHOENIX-1673
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-1673
>             Project: Phoenix
>          Issue Type: Improvement
>    Affects Versions: 4.3.0
>            Reporter: Mark Tse
>              Labels: Newbie, multi-tenant
>             Fix For: 4.4.1
>
>
> When creating multi-tenant tables and views, the column that identifies the 
> tenant (first primary key column) must be of type 'VARCHAR' or 'CHAR'.
> It should be possible to relax this restriction to use any integral data 
> type. The tenant ID from the connection property can be converted based on 
> the data type of the first primary key column.



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

Reply via email to