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

Samarth Jain commented on PHOENIX-1089:
---------------------------------------

[~jamestaylor]

Below is the test case for a query against tenant specific view that has an RVC 
with all the columns. The filter currently being used is RowKeyComparisonFilter 
and not SkipScanFilter. 

{code}
@Test
    public void testFullyQualifiedRVCWithTenantSpecificConnection() throws 
Exception {
        String baseTableDDL = "CREATE TABLE BASE_MULTI_TENANT_TABLE(\n " + 
                "  tenant_id VARCHAR(5) NOT NULL,\n" + 
                "  userid INTEGER NOT NULL,\n" + 
                "  username VARCHAR NOT NULL,\n" +
                "  col VARCHAR\n " + 
                "  CONSTRAINT pk PRIMARY KEY (tenant_id, userid, username)) 
MULTI_TENANT=true";
        Connection conn = DriverManager.getConnection(getUrl());
        conn.createStatement().execute(baseTableDDL);
        conn.close();
        
        String tenantId = "tenantId";
        String tenantViewDDL = "CREATE VIEW TENANT_VIEW AS SELECT * FROM 
BASE_MULTI_TENANT_TABLE";
        Properties props = TEST_PROPERTIES;
        props.put(PhoenixRuntime.TENANT_ID_ATTRIB, tenantId);
        conn = DriverManager.getConnection(getUrl(), props);
        conn.createStatement().execute(tenantViewDDL);
        
        String query = "SELECT * FROM TENANT_VIEW WHERE (userid, username) IN 
((?, ?), (?, ?))";
        List<Object> binds = Arrays.<Object>asList(1, "uname1", 2, "uname2");
        StatementContext context = compileStatement(query, binds);
        Scan scan = context.getScan();
        Filter filter = scan.getFilter();
        assertTrue(filter instanceof SkipScanFilter);
    }
{code}

> Row value constructors performance issue with multi-tenant views
> ----------------------------------------------------------------
>
>                 Key: PHOENIX-1089
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-1089
>             Project: Phoenix
>          Issue Type: Bug
>    Affects Versions: 3.0.0, 4.0.0, 5.0.0
>            Reporter: Samarth Jain
>            Assignee: Samarth Jain
>
> Row value constructors expect all pk columns to be present in braces. 
> However, tenant-specific views (and maybe also regular views?) add the 
> tenant_id column like this:
> tenant_id = 'abc' AND (pkcol1, pkcol2) in ('a', 'b'). This likely brakes the 
> performance benefit afforded by row-value constructors.
> To make row value constructors work correctly it should be :
> (tenant_id, pkcol1, pkcol2) in ('abc', 'a', 'b')
> [~jamestaylor]



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to