[
https://issues.apache.org/jira/browse/PHOENIX-1385?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
James Taylor updated PHOENIX-1385:
----------------------------------
Attachment: PHOENIX-1385.patch
Patch to fix NPE. The problem was that when multiple columns were being
dropped, we weren't updating our cache in one shot. The second drop column was
being ignore b/c it looked like the cache was up-to-date based on new table
timestamp from processing the first column in the list.
> Adding, dropping and adding columns fails with NPE
> --------------------------------------------------
>
> Key: PHOENIX-1385
> URL: https://issues.apache.org/jira/browse/PHOENIX-1385
> Project: Phoenix
> Issue Type: Bug
> Affects Versions: 4.1
> Reporter: Samarth Jain
> Attachments: PHOENIX-1385.patch
>
>
> {code}
> @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)
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)