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

Adding, dropping and adding columns fails with NPE

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 4.1.0
    • 4.2.0, 3.2.0
    • None
    • None

    Description

      @Test
          public void testAddColumnsUsingNewConnection() throws Exception {
          	Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
              String ddl = "CREATE TABLE T (\n"
              	    +"ID1 VARCHAR(15) NOT NULL,\n"
              	    +"ID2 VARCHAR(15) NOT NULL,\n"
              	    +"CREATED_DATE DATE,\n"
              	    +"CREATION_TIME BIGINT,\n"
              	    +"LAST_USED DATE,\n"
              	    +"CONSTRAINT PK PRIMARY KEY (ID1, ID2))";
              Connection conn1 = DriverManager.getConnection(getUrl(), props);
              conn1.createStatement().execute(ddl);
              ddl = "ALTER TABLE T ADD STRING VARCHAR, STRING_DATA_TYPES VARCHAR";
              conn1.createStatement().execute(ddl);
              ddl = "ALTER TABLE T DROP COLUMN STRING, STRING_DATA_TYPES";
              conn1.createStatement().execute(ddl);
              ddl = "ALTER TABLE T ADD STRING_ARRAY1 VARCHAR[]";
              conn1.createStatement().execute(ddl);
              conn1.close();
          }
      
      
      Exception:
      java.lang.NullPointerException: at index 6
      	at com.google.common.collect.ImmutableList.checkElementNotNull(ImmutableList.java:311)
      	at com.google.common.collect.ImmutableList.construct(ImmutableList.java:302)
      	at com.google.common.collect.ImmutableList.copyOf(ImmutableList.java:278)
      	at org.apache.phoenix.schema.PTableImpl.init(PTableImpl.java:338)
      	at org.apache.phoenix.schema.PTableImpl.<init>(PTableImpl.java:246)
      	at org.apache.phoenix.schema.PTableImpl.makePTable(PTableImpl.java:205)
      	at org.apache.phoenix.schema.PMetaDataImpl.addColumn(PMetaDataImpl.java:315)
      	at org.apache.phoenix.query.ConnectionQueryServicesImpl$1.mutate(ConnectionQueryServicesImpl.java:495)
      	at org.apache.phoenix.query.ConnectionQueryServicesImpl.metaDataMutated(ConnectionQueryServicesImpl.java:459)
      	at org.apache.phoenix.query.ConnectionQueryServicesImpl.addColumn(ConnectionQueryServicesImpl.java:491)
      	at org.apache.phoenix.jdbc.PhoenixConnection.addColumn(PhoenixConnection.java:732)
      	at org.apache.phoenix.schema.MetaDataClient.addColumn(MetaDataClient.java:2073)
      	at org.apache.phoenix.jdbc.PhoenixStatement$ExecutableAddColumnStatement$1.execute(PhoenixStatement.java:750)
      	at org.apache.phoenix.jdbc.PhoenixStatement$3.call(PhoenixStatement.java:260)
      	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:251)
      	at org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1037)
      	at org.apache.phoenix.end2end.AlterTableIT.testAddColumnsUsingNewConnection(AlterTableIT.java:913)
      
      

      Attachments

        1. PHOENIX-1385.patch
          13 kB
          James R. Taylor

        Activity

          People

            jamestaylor James R. Taylor
            samarthjain Samarth Jain
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: