Rajeshbabu Chintaguntla created PHOENIX-3990: ------------------------------------------------
Summary: Support view extended columns in Phoenix-Calcite Key: PHOENIX-3990 URL: https://issues.apache.org/jira/browse/PHOENIX-3990 Project: Phoenix Issue Type: Bug Reporter: Rajeshbabu Chintaguntla Assignee: Rajeshbabu Chintaguntla When we create view with extra columns and upsert into the view then calcite was not able to recognise the additional columns in the view and failing with column not found exception. Here is the base table: {noformat} PARENT_TABLE_DDL = "CREATE TABLE " + PARENT_TABLE_NAME + " ( \n" + " \"user\" VARCHAR ,\n" + " tenant_id VARCHAR NOT NULL,\n" + " tenant_type_id VARCHAR(3) NOT NULL, \n" + " id INTEGER NOT NULL\n" + " CONSTRAINT pk PRIMARY KEY (tenant_id, tenant_type_id, id)) MULTI_TENANT=true, IMMUTABLE_ROWS=true"; {noformat} Here is the view: {noformat} TENANT_TABLE_DDL = "CREATE VIEW " + TENANT_TABLE_NAME + " ( \n" + " tenant_col VARCHAR) AS SELECT *\n" + " FROM " + PARENT_TABLE_NAME + " WHERE tenant_type_id= '" + TENANT_TYPE_ID + "'"; {noformat} Upsert query: {noformat} conn.createStatement().executeUpdate("upsert into " + TENANT_TABLE_NAME + " (id, tenant_col) values (1, 'Cheap Sunglasses')"); {noformat} Failing with TENANT_COL not present in view. {noformat} java.sql.SQLException: Error while executing SQL "upsert into V_T000010 (id, tenant_col) values (1, 'Cheap Sunglasses')": From line 1, column 28 to line 1, column 37: Unknown target column 'TENANT_COL' at org.apache.phoenix.end2end.TenantSpecificTablesDMLIT.testJoinWithGlobalTable(TenantSpecificTablesDMLIT.java:155) Caused by: org.apache.calcite.runtime.CalciteContextException: From line 1, column 28 to line 1, column 37: Unknown target column 'TENANT_COL' {noformat} -- This message was sent by Atlassian JIRA (v6.4.14#64029)