[ https://issues.apache.org/jira/browse/PHOENIX-7391?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
rejeb ben rejeb updated PHOENIX-7391: ------------------------------------- Description: Given multitenant table: {code:java} CREATE TABLE MULTITENANT_TABLE (TENANT_ID VARCHAR NOT NULL, GLOBAL_COL1 VARCHAR, GLOBAL_COL2 VARCHAR CONSTRAINT pk PRIMARY KEY (TENANT_ID, GLOBAL_COL1)) MULTI_TENANT=true{code} Create View with tenantId= "MyTenantId": {code:java} CREATE VIEW IF NOT EXISTS TENANT_VIEW(TENANT_ONLY_COL VARCHAR) AS SELECT * FROM MULTITENANT_TEST_TABLE {code} When call: {code:java} Properties props = new Properties(); props.setProperty(PhoenixRuntime.TENANT_ID_ATTRIB, "MyTenantId"); Connection conn = DriverManager.getConnection(getUrl(), props); List<String> result = PhoenixRuntime.generateColumnInfo(tsconn,"TENANT_VIEW",null).stream() .map(ColumnInfo::getDisplayName).collect(Collectors.toList());{code} Expected result is: GLOBAL_COL1,GLOBAL_COL2,TENANT_ONLY_COL Actual: TENANT_ID, GLOBAL_COL1,GLOBAL_COL2,TENANT_ONLY_COL When I looked at method implementation I foud out that salted column was filtered when getting columns info but not the tenantId column: {code:java} <line 5612> int offset = (table.getBucketNum() == null ? 0 : 1); {code} was: Given multitenant table: {code:java} CREATE TABLE MULTITENANT_TABLE (TENANT_ID VARCHAR NOT NULL, GLOBAL_COL1 VARCHAR, GLOBAL_COL2 VARCHAR CONSTRAINT pk PRIMARY KEY (TENANT_ID, GLOBAL_COL1)) MULTI_TENANT=true{code} Create View with tenantId= "MyTenantId": {code:java} CREATE VIEW IF NOT EXISTS TENANT_VIEW(TENANT_ONLY_COL VARCHAR) AS SELECT * FROM MULTITENANT_TEST_TABLE {code} When call: {code:java} Properties props = new Properties(); props.setProperty(PhoenixRuntime.TENANT_ID_ATTRIB, "MyTenantId"); Connection conn = DriverManager.getConnection(getUrl(), props); List<String> result = PhoenixRuntime.generateColumnInfo(tsconn,"TENANT_VIEW",null).stream() .map(ColumnInfo::getDisplayName).collect(Collectors.toList());{code} Expected result is: GLOBAL_COL1,GLOBAL_COL2,TENANT_ONLY_COL Actual: TENANT_ID, GLOBAL_COL1,GLOBAL_COL2,TENANT_ONLY_COL When I looked at method implementation I foud out that salted column is filtered when getting columns info but not the tenantId column: {code:java} <line 5612> int offset = (table.getBucketNum() == null ? 0 : 1); {code} > PhoenixRuntime.generateColumnInfo does not filter tenant_id column > ------------------------------------------------------------------ > > Key: PHOENIX-7391 > URL: https://issues.apache.org/jira/browse/PHOENIX-7391 > Project: Phoenix > Issue Type: Bug > Components: core > Reporter: rejeb ben rejeb > Assignee: rejeb ben rejeb > Priority: Minor > > Given multitenant table: > {code:java} > CREATE TABLE MULTITENANT_TABLE (TENANT_ID VARCHAR NOT NULL, GLOBAL_COL1 > VARCHAR, GLOBAL_COL2 VARCHAR CONSTRAINT pk PRIMARY KEY (TENANT_ID, > GLOBAL_COL1)) MULTI_TENANT=true{code} > > Create View with tenantId= "MyTenantId": > {code:java} > CREATE VIEW IF NOT EXISTS TENANT_VIEW(TENANT_ONLY_COL VARCHAR) AS SELECT * > FROM MULTITENANT_TEST_TABLE {code} > When call: > {code:java} > Properties props = new Properties(); > props.setProperty(PhoenixRuntime.TENANT_ID_ATTRIB, "MyTenantId"); > Connection conn = DriverManager.getConnection(getUrl(), props); > List<String> result = > PhoenixRuntime.generateColumnInfo(tsconn,"TENANT_VIEW",null).stream() > .map(ColumnInfo::getDisplayName).collect(Collectors.toList());{code} > Expected result is: GLOBAL_COL1,GLOBAL_COL2,TENANT_ONLY_COL > Actual: TENANT_ID, GLOBAL_COL1,GLOBAL_COL2,TENANT_ONLY_COL > > When I looked at method implementation I foud out that salted column was > filtered when getting columns info but not the tenantId column: > {code:java} > <line 5612> int offset = (table.getBucketNum() == null ? 0 : 1); {code} > -- This message was sent by Atlassian Jira (v8.20.10#820010)