[ https://issues.apache.org/jira/browse/PHOENIX-6961?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Istvan Toth updated PHOENIX-6961: --------------------------------- Priority: Critical (was: Major) > Using a covered field in hinted non-covered indexed query fails > --------------------------------------------------------------- > > Key: PHOENIX-6961 > URL: https://issues.apache.org/jira/browse/PHOENIX-6961 > Project: Phoenix > Issue Type: Bug > Components: core > Affects Versions: 5.2.0, 5.1.3 > Reporter: Istvan Toth > Assignee: Istvan Toth > Priority: Critical > > When covered fields are to be used in a hinted uncovered index lookup, > Phoenix fails with a bogus error message. > {noformat} > 0: jdbc:phoenix:localhost:59972> create table d (v1 integer, k integer > primary key, v2 integer, v3 integer, v4 integer); > No rows affected (2.15 seconds) > 0: jdbc:phoenix:localhost:59972> create index i on d(v2) include (v3); > No rows affected (7.177 seconds) > 0: jdbc:phoenix:localhost:59972> select /*+ index(d i) */ * from d where v2=1 > and v3=1; > Error: ERROR 514 (42892): A duplicate column name was detected in the object > definition or ALTER TABLE/VIEW statement. columnName=I.V1 > (state=42892,code=514) > org.apache.phoenix.schema.ColumnAlreadyExistsException: ERROR 514 (42892): A > duplicate column name was detected in the object definition or ALTER > TABLE/VIEW statement. columnName=I.V1 > at > org.apache.phoenix.schema.PTableImpl$Builder.initDerivedAttributes(PTableImpl.java:694) > at org.apache.phoenix.schema.PTableImpl$Builder.build(PTableImpl.java:802) > at > org.apache.phoenix.compile.TupleProjectionCompiler.createProjectedTable(TupleProjectionCompiler.java:179) > at > org.apache.phoenix.compile.QueryCompiler.compileSingleFlatQuery(QueryCompiler.java:701) > at > org.apache.phoenix.compile.QueryCompiler.compileSingleQuery(QueryCompiler.java:667) > at > org.apache.phoenix.compile.QueryCompiler.compileSelect(QueryCompiler.java:249) > at org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:178) > at org.apache.phoenix.optimize.QueryOptimizer.addPlan(QueryOptimizer.java:348) > at > org.apache.phoenix.optimize.QueryOptimizer.getHintedQueryPlan(QueryOptimizer.java:302) > at > org.apache.phoenix.optimize.QueryOptimizer.getApplicablePlansForSingleFlatQuery(QueryOptimizer.java:230) > at > org.apache.phoenix.optimize.QueryOptimizer.getApplicablePlans(QueryOptimizer.java:138) > at > org.apache.phoenix.optimize.QueryOptimizer.optimize(QueryOptimizer.java:116) > at > org.apache.phoenix.optimize.QueryOptimizer.optimize(QueryOptimizer.java:102) > at org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:319) > at org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:301) > at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53) > at > org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:300) > at > org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:293) > at > org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:2038) > at sqlline.Commands.executeSingleQuery(Commands.java:1130) > at sqlline.Commands.execute(Commands.java:1079) > at sqlline.Commands.sql(Commands.java:1033) > at sqlline.SqlLine.dispatch(SqlLine.java:822) > at sqlline.SqlLine.begin(SqlLine.java:596) > at sqlline.SqlLine.start(SqlLine.java:269) > at sqlline.SqlLine.main(SqlLine.java:208) > {noformat} > I thought that this was caused by the PK field not being the first, but the > same happens with: > {noformat} > create table d (k integer primary key, v1 integer, v2 integer, v3 integer, v4 > integer); > {noformat} > > This is a relatively recent issue, this works fine on an earlier 5.1 version,. -- This message was sent by Atlassian Jira (v8.20.10#820010)