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

James Taylor commented on PHOENIX-1366:
---------------------------------------

The easiest way I can think of solving this would be to:
- add a dynamic column to the getColumns() query:
{code}
... FROM SYSTEM.CATALOG(OVERRIDE_ORDINAL_POSITION BOOLEAN) ...
{code}
- modify the SELECT expression for ORDINAL_POSITION to subtract one from 
ORDINAL_POSITION if the dynamic column is set
{code}
SELECT ... CASE WHEN OVERRIDE_ORDINAL_POSITION THEN ORDINAL_POSITION-1 ELSE 
ORDINAL_POSITION END as ORDINAL_POSITION ...
{code}
- modify your custom iterator code to set the OVERRIDE_ORDINAL_POSITION 
KeyValue to PDataType.TRUE_BYTES in the Tuple after you skip the TENANT_ID 
column.

> ORDINAL_POSITION incorrect for multi-tenant table over tenant-specific 
> connection
> ---------------------------------------------------------------------------------
>
>                 Key: PHOENIX-1366
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-1366
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: James Taylor
>
> We strip out the tenant ID column from our 
> connection.getMetaData().getColumns() call for a multi-tenant table over a 
> tenant-specific connection as of PHOENIX-1271. However, in doing so, we 
> should adjust down the ORDINAL_POSITION by one for every column *after* the 
> tenant ID column.



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

Reply via email to