[ https://issues.apache.org/jira/browse/PHOENIX-2301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14945916#comment-14945916 ]
Julian Jaffe commented on PHOENIX-2301: --------------------------------------- {code:SQL}CREATE TABLE IF NOT EXISTS TEST.TEST("testInt" INTEGER, "testCharArray" CHAR(3)[] CONSTRAINT "test_test" PRIMARY KEY ("testInt")) DEFAULT_COLUMN_FAMILY='TT', SALT_BUCKETS=10; No rows affected (1.631 seconds) 0: jdbc:phoenix:xxxxxx> UPSERT INTO TEST.TEST VALUES(5, ARRAY['aaa','bbb']); 1 row affected (0.164 seconds) 0: jdbc:phoenix:xxxxxx> SELECT * FROM TEST.TEST; +------------------------------------------+---------------+ | testInt | testCharArray | +------------------------------------------+---------------+ | 5 | ['aaa', 'bbb'] | +------------------------------------------+---------------+ 1 row selected (0.364 seconds) 0: jdbc:phoenix:xxxxxx> UPSERT INTO TEST.TEST("testInt", "testCharArray") SELECT "testInt", ARRAY['ccc'] FROM TEST.TEST WHERE "testInt" = 5; Error: java.lang.NullPointerException (state=08000,code=101) org.apache.phoenix.exception.PhoenixIOException: java.lang.NullPointerException at org.apache.phoenix.util.ServerUtil.parseServerException(ServerUtil.java:108) at org.apache.phoenix.iterate.BaseResultIterators.getIterators(BaseResultIterators.java:553) at org.apache.phoenix.iterate.RoundRobinResultIterator.getIterators(RoundRobinResultIterator.java:176) at org.apache.phoenix.iterate.RoundRobinResultIterator.next(RoundRobinResultIterator.java:91) at org.apache.phoenix.compile.UpsertCompiler$2.execute(UpsertCompiler.java:685) at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:319) at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:311) at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53) at org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:309) at org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1432) at sqlline.Commands.execute(Commands.java:822) at sqlline.Commands.sql(Commands.java:732) at sqlline.SqlLine.dispatch(SqlLine.java:808) at sqlline.SqlLine.begin(SqlLine.java:681) at sqlline.SqlLine.start(SqlLine.java:398) at sqlline.SqlLine.main(SqlLine.java:292) Caused by: java.util.concurrent.ExecutionException: java.lang.NullPointerException at java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.util.concurrent.FutureTask.get(FutureTask.java:206) at org.apache.phoenix.iterate.BaseResultIterators.getIterators(BaseResultIterators.java:549) ... 14 more Caused by: java.lang.NullPointerException{code} UPSERT SELECT fails as well. However, VARCHAR(3)[] doesn't result in an NPE, and is a pretty painless workaround. > NullPointerException when upserting into a char array column > ------------------------------------------------------------ > > Key: PHOENIX-2301 > URL: https://issues.apache.org/jira/browse/PHOENIX-2301 > Project: Phoenix > Issue Type: Bug > Affects Versions: 4.5.2 > Reporter: Julian Jaffe > > Attempting to upsert into a char array causes an NPE. Minimum example: > {code:sql} > 0: jdbc:phoenix:xxxxxx> CREATE TABLE IF NOT EXISTS TEST("testIntArray" > INTEGER[], CONSTRAINT "test_pk" PRIMARY KEY("testIntArray")) > DEFAULT_COLUMN_FAMILY='T'; > No rows affected (1.28 seconds) > 0: jdbc:phoenix:xxxxxx> UPSERT INTO TEST VALUES (ARRAY[1, 2, 3]); > 1 row affected (0.184 seconds) > 0: jdbc:phoenix:xxxxxx> SELECT * FROM TEST; > +------------------------------------------+ > | testIntArray | > +------------------------------------------+ > | [1, 2, 3] | > +------------------------------------------+ > 1 row selected (0.308 seconds) > 0: jdbc:phoenix:xxxxxx> DROP TABLE IF EXISTS TEST; > No rows affected (3.348 seconds) > 0: jdbc:phoenix:xxxxxx> CREATE TABLE IF NOT EXISTS TEST("testCharArray" > CHAR(3)[], CONSTRAINT "test_pk" PRIMARY KEY("testCharArray")) > DEFAULT_COLUMN_FAMILY='T'; > No rows affected (1.446 seconds) > 0: jdbc:phoenix:xxxxxx> UPSERT INTO TEST VALUES (ARRAY['aaa', 'bbb', 'ccc']); > java.lang.NullPointerException > at > org.apache.phoenix.schema.types.PArrayDataType.createPhoenixArray(PArrayDataType.java:1123) > at > org.apache.phoenix.schema.types.PArrayDataType.toObject(PArrayDataType.java:338) > at > org.apache.phoenix.schema.types.PCharArray.toObject(PCharArray.java:64) > at > org.apache.phoenix.schema.types.PDataType.toObject(PDataType.java:967) > at > org.apache.phoenix.schema.types.PDataType.toObject(PDataType.java:1008) > at > org.apache.phoenix.schema.types.PDataType.toObject(PDataType.java:1004) > at org.apache.phoenix.util.SchemaUtil.toString(SchemaUtil.java:381) > at org.apache.phoenix.schema.PTableImpl.newKey(PTableImpl.java:572) > at > org.apache.phoenix.compile.UpsertCompiler.setValues(UpsertCompiler.java:117) > at > org.apache.phoenix.compile.UpsertCompiler.access$400(UpsertCompiler.java:98) > at > org.apache.phoenix.compile.UpsertCompiler$3.execute(UpsertCompiler.java:821) > at > org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:319) > at > org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:311) > at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53) > at > org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:309) > at > org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1432) > at sqlline.Commands.execute(Commands.java:822) > at sqlline.Commands.sql(Commands.java:732) > at sqlline.SqlLine.dispatch(SqlLine.java:808) > at sqlline.SqlLine.begin(SqlLine.java:681) > at sqlline.SqlLine.start(SqlLine.java:398) > at sqlline.SqlLine.main(SqlLine.java:292) > 0: jdbc:phoenix:xxxxxx> SELECT * FROM TEST; > +---------------+ > | testCharArray | > +---------------+ > +---------------+ > No rows selected (0.169 seconds) > 0: jdbc:phoenix:xxxxxx> SELECT "testCharArray" FROM TEST; > +---------------+ > | testCharArray | > +---------------+ > +---------------+ > No rows selected (0.182 seconds) > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)