[ 
https://issues.apache.org/jira/browse/PHOENIX-577?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gabriel Reid resolved PHOENIX-577.
----------------------------------

    Resolution: Fixed

Bulk resolve of closed issues imported from GitHub. This status was reached by 
first re-opening all closed imported issues and then resolving them in bulk.

> NullPointerException in IndexMaintainer
> ---------------------------------------
>
>                 Key: PHOENIX-577
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-577
>             Project: Phoenix
>          Issue Type: Task
>    Affects Versions: 2.1.0-Release
>            Reporter: Artur Denysenko
>              Labels: bug
>
> I work with UUID 16 bytes columns:
> ```sql
> CREATE TABLE IF NOT EXISTS log ( 
> id BINARY(16) NOT NULL PRIMARY KEY,
> c  BINARY(16) NOT NULL,
> t  BINARY(16) NOT NULL
> e  VARCHAR(255) NOT NULL)
> IMMUTABLE_ROWS=true;
> CREATE INDEX IF NOT EXISTS log_idx_t ON log(t);
> CREATE INDEX IF NOT EXISTS log_idx_c ON log(c);
> ```
> I have this exception:
> ```
> java.lang.NullPointerException
>       at 
> com.salesforce.phoenix.index.IndexMaintainer.buildRowKey(IndexMaintainer.java:269)
>       at 
> com.salesforce.phoenix.index.IndexMaintainer.buildUpdateMutation(IndexMaintainer.java:306)
>       at 
> com.salesforce.phoenix.util.IndexUtil.generateIndexData(IndexUtil.java:171)
>       at 
> com.salesforce.phoenix.execute.MutationState$1.next(MutationState.java:203)
>       at 
> com.salesforce.phoenix.execute.MutationState$1.next(MutationState.java:186)
>       at 
> com.salesforce.phoenix.execute.MutationState.commit(MutationState.java:335)
>       at 
> com.salesforce.phoenix.jdbc.PhoenixConnection.commit(PhoenixConnection.java:249)
>       at 
> com.salesforce.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:187)
>       at 
> com.salesforce.phoenix.jdbc.PhoenixStatement.access$600(PhoenixStatement.java:74)
>       at 
> com.salesforce.phoenix.jdbc.PhoenixStatement$ExecutableUpsertStatement.executeUpdate(PhoenixStatement.java:217)
>       at 
> com.salesforce.phoenix.jdbc.PhoenixPreparedStatement.executeUpdate(PhoenixPreparedStatement.java:103)
> ```
> And it happens then we try to use null [indexColumnType] resulted from 
> [IndexUtil.getIndexColumnDataType(isNullable=true, dataColumnType="BYTE")]
> ```java
> boolean isNullable = true;
> ...
> if (dataPkPosition[i] == -1) {
>       dataColumnType = indexedColumnTypes.get(j);
>       ImmutableBytesPtr value = valueGetter.getLatestValue(iterator.next());
>       if (value == null) {
>               ptr.set(ByteUtil.EMPTY_BYTE_ARRAY);
>       } else {
>               ptr.set(value.copyBytesIfNecessary());
>       }
>       j++;
> } else {
>                // does not execute in our case
> }
> PDataType indexColumnType = IndexUtil.getIndexColumnDataType(isNullable, 
> dataColumnType);
> ```



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to