[
https://issues.apache.org/jira/browse/PHOENIX-6644?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Kadir Ozdemir reassigned PHOENIX-6644:
--------------------------------------
Assignee: Saurabh Rai
> Column name based Result Set getter issue with view indexes
> -----------------------------------------------------------
>
> Key: PHOENIX-6644
> URL: https://issues.apache.org/jira/browse/PHOENIX-6644
> Project: Phoenix
> Issue Type: Improvement
> Affects Versions: 5.1.2
> Reporter: Kadir Ozdemir
> Assignee: Saurabh Rai
> Priority: Major
>
> If a column used to define the view is also a projected column in a select
> clause, a view index is chosen by the Phoenix query optimizer for the select
> statement, and the value of the projected column is retrieved using the
> column name based ResultSet getter, Phoenix returns ColumnNotFoundException.
> For example, the last assertEquals fails with
> {quote}org.apache.phoenix.schema.ColumnNotFoundException: ERROR 504 (42703):
> Undefined column. columnName=V1
> {quote}
> in the following integration test:
> {code:java}
> @Test
> public void test() throws Exception {
> try (Connection conn = DriverManager.getConnection(getUrl())) {
> conn.createStatement().execute("create table T "+
> " (id INTEGER not null primary key, v1 varchar, v2 varchar,
> v3 varchar)");
> conn.createStatement().execute("CREATE VIEW V AS SELECT * FROM T
> WHERE v1 = 'a'");
> conn.createStatement().execute("CREATE INDEX I ON V (v2) INCLUDE
> (v3)");
> conn.createStatement().execute("upsert into V values (1, 'a', 'ab',
> 'abc')");
> conn.commit();
> ResultSet rs = conn.createStatement().executeQuery("SELECT v1, v3
> from V WHERE v2 = 'ab'");
> assertTrue(rs.next());
> assertEquals("a", rs.getString(1));
> assertEquals("a", rs.getString("v1"));
> }
> } {code}
> Without the view index, the above test passes.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)