Uploaded image for project: 'Phoenix'
  1. Phoenix
  2. PHOENIX-4721

Adding PK column to a table with multiple secondary indexes fails

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 4.13.0
    • 4.14.0, 5.0.0
    • None
    • None

    Description

      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:

      ALTER TABLE TEST.ACTIVITY ADD SOURCE VARCHAR(25) NULL PRIMARY KEY
      

      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:

      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)
      

      See attached file for a detailed repro.

      Attachments

        1. AlterTableExtendPk.java
          2 kB
          Jan Fernando
        2. PHOENIX-4721_v1.patch
          5 kB
          James R. Taylor

        Activity

          People

            jamestaylor James R. Taylor
            jfernando_sfdc Jan Fernando
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: