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

Karel Vervaeke commented on PHOENIX-1271:
-----------------------------------------

My fugly knee-jerk solution was something along these lines

+        if (connection.getTenantId() != null) {
+            // exclude the first PK for all multi tenant tables
+            for (PTable table: 
Iterators.toArray(connection.getMetaDataCache().iterator(), PTable.class)) {
+                if (!table.isMultiTenant()) {
+                    continue;
+                }
+                appendConjunction(where);
+                // this is just a test, ignoring the conditions on schema and 
catalog for now
+                where.append(String.format("(TABLE_NAME <> '%s' OR 
ORDINAL_POSITION > 2)", table.getName()));
+
+            }
+        }

Not exactly elegant + multi-tenant tables now start with ORDINAL_POSITION=2.
I'll try James' first suggestion and see there what takes me.

> Column metadata doesn't hide tenant column on tenant-specific connections.
> --------------------------------------------------------------------------
>
>                 Key: PHOENIX-1271
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-1271
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: Karel Vervaeke
>
> connection.getMetaData().getColumns(...) always returns all columns.
> For multi-tenant tables it would make more sense if the first PK (the 
> tenant-id column) would be excluded. If we do this the number of columns 
> returned would match the number of columns you get when executing a "select 
> *" query.



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

Reply via email to