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

duplicated columns cause query exception and drop table exception

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 4.9.0, 4.8.1
    • None
    • None

    Description

      when I create table like this: "create table test (id varchar not null primary key, f.name varchar, f.email varchar, f.email varchar)", this will cause an org.apache.phoenix.schema.ColumnAlreadyExistsException, but the table is successful created.

      Then I run a query like "select * from test", an exception is threw:
      Caused by: java.lang.ArrayIndexOutOfBoundsException: 3
      at org.apache.phoenix.schema.PTableImpl.init(PTableImpl.java:283)
      at org.apache.phoenix.schema.PTableImpl.<init>(PTableImpl.java:216)
      at org.apache.phoenix.schema.PTableImpl.makePTable(PTableImpl.java:209)
      at org.apache.phoenix.coprocessor.MetaDataEndpointImpl.getTable(MetaDataEndpointImpl.java:443)
      at org.apache.phoenix.coprocessor.MetaDataEndpointImpl.buildTable(MetaDataEndpointImpl.java:254)
      at org.apache.phoenix.coprocessor.MetaDataEndpointImpl.doGetTable(MetaDataEndpointImpl.java:1077)
      at org.apache.phoenix.coprocessor.MetaDataEndpointImpl.getTable(MetaDataEndpointImpl.java:1023)
      ... 10 more

      then I try to drop the table: "drop table test", an exception is also threw:
      Caused by: java.lang.ArrayIndexOutOfBoundsException: 3
      at org.apache.phoenix.schema.PTableImpl.init(PTableImpl.java:283)
      at org.apache.phoenix.schema.PTableImpl.<init>(PTableImpl.java:216)
      at org.apache.phoenix.schema.PTableImpl.makePTable(PTableImpl.java:209)
      at org.apache.phoenix.coprocessor.MetaDataEndpointImpl.getTable(MetaDataEndpointImpl.java:443)
      at org.apache.phoenix.coprocessor.MetaDataEndpointImpl.buildTable(MetaDataEndpointImpl.java:254)
      at org.apache.phoenix.coprocessor.MetaDataEndpointImpl.doGetTable(MetaDataEndpointImpl.java:1077)
      at org.apache.phoenix.coprocessor.MetaDataEndpointImpl.getTable(MetaDataEndpointImpl.java:1023)
      ... 10 more

      So I have to drop SYSTEM.CATALOG, SYSTEM.SEQUENCE from hbase shell……

      The ArrayIndexOutOfBoundsException is threw out because the position of f.email column in CATALOG table is not correct. I think it's better to check columns before creating table.

      Attachments

        1. PHOENIX-930
          1 kB
          Kai Wang
        2. PHOENIX-930_v4.patch
          23 kB
          James R. Taylor
        3. PHOENIX-930_v5.patch
          23 kB
          James R. Taylor
        4. PHOENIX-930.patch
          3 kB
          Junegunn Choi
        5. PHOENIX-930-v2.patch
          5 kB
          Junegunn Choi
        6. PHOENIX-930-v3.patch
          5 kB
          Junegunn Choi

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            junegunn Junegunn Choi
            wangkai Kai Wang
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment