You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by "Istvan Toth (Jira)" <ji...@apache.org> on 2023/06/02 10:26:00 UTC
[jira] [Commented] (PHOENIX-6969) Projection bug in hinted uncovered index query with order by
[ https://issues.apache.org/jira/browse/PHOENIX-6969?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17728677#comment-17728677 ]
Istvan Toth commented on PHOENIX-6969:
--------------------------------------
This is ultimately caused by IndexDataColumnRef equals/hashCode using the columns field, which is just a pointer to a field in context that changes during compilation, breaking HashSet and resulting in duplicate columns.
> Projection bug in hinted uncovered index query with order by
> --------------------------------------------------------------
>
> Key: PHOENIX-6969
> URL: https://issues.apache.org/jira/browse/PHOENIX-6969
> Project: Phoenix
> Issue Type: Bug
> Affects Versions: 5.2.0, 5.1.3
> Reporter: Istvan Toth
> Priority: Major
>
>
> When using order in some hinted uncovered queries, a ColumnAlreadyExistsException is thrown.
> {noformat}
> create table dd (k1 integer not null, k2 integer not null, k3 integer not null, k4 integer not null, v1 integer, v2 integer, v3 integer, v4 integer constraint pk primary key (k1,k2,k3,k4));
> create index ii on dd (k4, k1, k2, k3);
> select /*+ index(dd ii) */ k1, k2, k3, k4, v1, v2, v3, v4 from dd where k4=1 and k2=1 order by k1 asc, v1 asc limit 1;{noformat}
> {noformat}
> Error: ERROR 514 (42892): A duplicate column name was detected in the object definition or ALTER TABLE/VIEW statement. columnName=II.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=II.V1
> at org.apache.phoenix.schema.PTableImpl$Builder.initDerivedAttributes(PTableImpl.java:682)
> 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:1054)
> at sqlline.Commands.execute(Commands.java:1003)
> at sqlline.Commands.sql(Commands.java:967)
> at sqlline.SqlLine.dispatch(SqlLine.java:734)
> at sqlline.SqlLine.begin(SqlLine.java:541)
> at sqlline.SqlLine.start(SqlLine.java:267)
> at sqlline.SqlLine.main(SqlLine.java:206)
> {noformat}
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)