[
https://issues.apache.org/jira/browse/PHOENIX-4721?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16459467#comment-16459467
]
James Taylor edited comment on PHOENIX-4721 at 5/1/18 5:52 AM:
---------------------------------------------------------------
Please review, [~tdsilva]. This issue is due to two indexes being added - we
should only increment the pk slot position after processing all indexes. Thanks
for the test - that made things easy, [~jfernando_sfdc].
was (Author: jamestaylor):
Please review, [~tdsilva]. This issue is due to two indexes being added - we
should only increment the pk slot position after processing all indexes.
> Issuing ALTER TABLE to add a PK Column to a table with secondary indexes fails
> ------------------------------------------------------------------------------
>
> Key: PHOENIX-4721
> URL: https://issues.apache.org/jira/browse/PHOENIX-4721
> Project: Phoenix
> Issue Type: Bug
> Affects Versions: 4.13.0
> Reporter: Jan Fernando
> Assignee: James Taylor
> Priority: Major
> Fix For: 4.14.0, 5.0.0
>
> Attachments: AlterTableExtendPk.java, PHOENIX-4721_v1.patch
>
>
> The expected behavior when adding a PK column to table is that the column
> will successfully be added, even if the table has secondary indexes.
> For example:
> {code:java}
> ALTER TABLE TEST.ACTIVITY ADD SOURCE VARCHAR(25) NULL PRIMARY KEY
> {code}
> should execute successfully even if the table has secondary indexes defined.
> However issuing the above ALTER statement on a table with secondary indexes
> throws the following Exception:
> {code:java}
> java.util.NoSuchElementException
> at java.util.ArrayList$Itr.next(ArrayList.java:854)
> at
> org.apache.phoenix.schema.RowKeyValueAccessor.<init>(RowKeyValueAccessor.java:78)
> at
> org.apache.phoenix.schema.MetaDataClient.addColumn(MetaDataClient.java:3452)
> at
> org.apache.phoenix.schema.MetaDataClient.addColumn(MetaDataClient.java:3120)
> at
> org.apache.phoenix.jdbc.PhoenixStatement$ExecutableAddColumnStatement$1.execute(PhoenixStatement.java:1328)
> at org.apache.phoenix.jdbc.PhoenixStatement$3.call(PhoenixStatement.java:393)
> at org.apache.phoenix.jdbc.PhoenixStatement$3.call(PhoenixStatement.java:1)
> at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
> at
> org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:375)
> at
> org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:363)
> at org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:269)
> at
> org.apache.phoenix.jdbc.PhoenixPreparedStatement.execute(PhoenixPreparedStatement.java:172)
> at
> org.apache.phoenix.jdbc.PhoenixPreparedStatement.execute(PhoenixPreparedStatement.java:177)
> {code}
> See attached file for a detailed repro.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)