[jira] [Commented] (PHOENIX-2301) NullPointerException when upserting into a char array column

2015-11-15 Thread Hudson (JIRA)

[ 
https://issues.apache.org/jira/browse/PHOENIX-2301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15005917#comment-15005917
 ] 

Hudson commented on PHOENIX-2301:
-

FAILURE: Integrated in Phoenix-master #960 (See 
[https://builds.apache.org/job/Phoenix-master/960/])
PHOENIX-2301 NullPointerException when upserting into a char array (duminduk: 
rev 7afa91ab97a85b7e33f3a686e4ddff42697f50b2)
* phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
* phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java


> 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
>Assignee: Dumindu Buddhika
> Attachments: PHOENIX-2301.patch
>
>
> Attempting to upsert into a char array causes an NPE. Minimum example:
> {code:sql}
> 0: jdbc:phoenix:xx> 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:xx> UPSERT INTO TEST VALUES (ARRAY[1, 2, 3]);
> 1 row affected (0.184 seconds)
> 0: jdbc:phoenix:xx> SELECT * FROM TEST;
> +--+
> |   testIntArray   |
> +--+
> | [1, 2, 3]|
> +--+
> 1 row selected (0.308 seconds)
> 0: jdbc:phoenix:xx> DROP TABLE IF EXISTS TEST;
> No rows affected (3.348 seconds)
> 0: jdbc:phoenix:xx> 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:xx> 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:xx> SELECT * FROM TEST;
> +---+
> | testCharArray |
> +---+
> +---+
> No rows selected (0.169 seconds)
> 0: jdbc:phoenix:xx> SELECT "testCharArray" FROM TEST;
> +---+
> | testCharArray |
> +---+
> +---+
> No rows selected (0.182 seconds)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (PHOENIX-2301) NullPointerException when upserting into a char array column

2015-11-10 Thread Julian Jaffe (JIRA)

[ 
https://issues.apache.org/jira/browse/PHOENIX-2301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=14999272#comment-14999272
 ] 

Julian Jaffe commented on PHOENIX-2301:
---

The comment I left on October 6th about UPSERT SELECT failing is actually due 
to a different root cause. I have a patch for it, should I open a new issue or 
upload it here?

> 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
>Assignee: Dumindu Buddhika
> Attachments: PHOENIX-2301.patch
>
>
> Attempting to upsert into a char array causes an NPE. Minimum example:
> {code:sql}
> 0: jdbc:phoenix:xx> 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:xx> UPSERT INTO TEST VALUES (ARRAY[1, 2, 3]);
> 1 row affected (0.184 seconds)
> 0: jdbc:phoenix:xx> SELECT * FROM TEST;
> +--+
> |   testIntArray   |
> +--+
> | [1, 2, 3]|
> +--+
> 1 row selected (0.308 seconds)
> 0: jdbc:phoenix:xx> DROP TABLE IF EXISTS TEST;
> No rows affected (3.348 seconds)
> 0: jdbc:phoenix:xx> 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:xx> 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:xx> SELECT * FROM TEST;
> +---+
> | testCharArray |
> +---+
> +---+
> No rows selected (0.169 seconds)
> 0: jdbc:phoenix:xx> SELECT "testCharArray" FROM TEST;
> +---+
> | testCharArray |
> +---+
> +---+
> No rows selected (0.182 seconds)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (PHOENIX-2301) NullPointerException when upserting into a char array column

2015-11-10 Thread James Taylor (JIRA)

[ 
https://issues.apache.org/jira/browse/PHOENIX-2301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=14999698#comment-14999698
 ] 

James Taylor commented on PHOENIX-2301:
---

Please create a new JIRA for that one, [~jja...@marinsoftware.com]. I'll check 
this one in of Dumindu's behalf and close it as fixed.

> 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
>Assignee: Dumindu Buddhika
> Attachments: PHOENIX-2301.patch
>
>
> Attempting to upsert into a char array causes an NPE. Minimum example:
> {code:sql}
> 0: jdbc:phoenix:xx> 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:xx> UPSERT INTO TEST VALUES (ARRAY[1, 2, 3]);
> 1 row affected (0.184 seconds)
> 0: jdbc:phoenix:xx> SELECT * FROM TEST;
> +--+
> |   testIntArray   |
> +--+
> | [1, 2, 3]|
> +--+
> 1 row selected (0.308 seconds)
> 0: jdbc:phoenix:xx> DROP TABLE IF EXISTS TEST;
> No rows affected (3.348 seconds)
> 0: jdbc:phoenix:xx> 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:xx> 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:xx> SELECT * FROM TEST;
> +---+
> | testCharArray |
> +---+
> +---+
> No rows selected (0.169 seconds)
> 0: jdbc:phoenix:xx> SELECT "testCharArray" FROM TEST;
> +---+
> | testCharArray |
> +---+
> +---+
> No rows selected (0.182 seconds)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (PHOENIX-2301) NullPointerException when upserting into a char array column

2015-11-06 Thread Dumindu Buddhika (JIRA)

[ 
https://issues.apache.org/jira/browse/PHOENIX-2301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=14993618#comment-14993618
 ] 

Dumindu Buddhika commented on PHOENIX-2301:
---

There is a NPE. But it is caused at,
{code}
throw new DataExceedsCapacityException(name.getString() + "." + 
column.getName().getString() + " may not exceed " + maxLength + " bytes (" + 
SchemaUtil.toString(type, byteValue) + ")");
{code}

while generating the SchemaUtil.toString() since we do not pass in maxlength 
here. But now as we are skipping this test for arrays, it wont be a problem. 

> 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
>Assignee: Dumindu Buddhika
> Attachments: PHOENIX-2301.patch
>
>
> Attempting to upsert into a char array causes an NPE. Minimum example:
> {code:sql}
> 0: jdbc:phoenix:xx> 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:xx> UPSERT INTO TEST VALUES (ARRAY[1, 2, 3]);
> 1 row affected (0.184 seconds)
> 0: jdbc:phoenix:xx> SELECT * FROM TEST;
> +--+
> |   testIntArray   |
> +--+
> | [1, 2, 3]|
> +--+
> 1 row selected (0.308 seconds)
> 0: jdbc:phoenix:xx> DROP TABLE IF EXISTS TEST;
> No rows affected (3.348 seconds)
> 0: jdbc:phoenix:xx> 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:xx> 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:xx> SELECT * FROM TEST;
> +---+
> | testCharArray |
> +---+
> +---+
> No rows selected (0.169 seconds)
> 0: jdbc:phoenix:xx> SELECT "testCharArray" FROM TEST;
> +---+
> | testCharArray |
> +---+
> +---+
> No rows selected (0.182 seconds)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (PHOENIX-2301) NullPointerException when upserting into a char array column

2015-11-05 Thread Dumindu Buddhika (JIRA)

[ 
https://issues.apache.org/jira/browse/PHOENIX-2301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=14991617#comment-14991617
 ] 

Dumindu Buddhika commented on PHOENIX-2301:
---

Thanks for the review [~jamestaylor]. No byteValue contains the array, in this 
case [a,a,a,b,b,b,c,c,c]. But since we compare byteValue.length directly with 
maxlength (here 3), this problem occurs when a char array is present. We can 
obtain the length of the array and do a different comparison 
(maxlength*elements>byteValue.length) in case of fixedlength element arrays 
with maxlength non null. What do you think?

In case element values are bigger than maxlength an exception occurs.

> 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
>Assignee: Dumindu Buddhika
> Attachments: PHOENIX-2301.patch
>
>
> Attempting to upsert into a char array causes an NPE. Minimum example:
> {code:sql}
> 0: jdbc:phoenix:xx> 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:xx> UPSERT INTO TEST VALUES (ARRAY[1, 2, 3]);
> 1 row affected (0.184 seconds)
> 0: jdbc:phoenix:xx> SELECT * FROM TEST;
> +--+
> |   testIntArray   |
> +--+
> | [1, 2, 3]|
> +--+
> 1 row selected (0.308 seconds)
> 0: jdbc:phoenix:xx> DROP TABLE IF EXISTS TEST;
> No rows affected (3.348 seconds)
> 0: jdbc:phoenix:xx> 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:xx> 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:xx> SELECT * FROM TEST;
> +---+
> | testCharArray |
> +---+
> +---+
> No rows selected (0.169 seconds)
> 0: jdbc:phoenix:xx> SELECT "testCharArray" FROM TEST;
> +---+
> | testCharArray |
> +---+
> +---+
> No rows selected (0.182 seconds)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (PHOENIX-2301) NullPointerException when upserting into a char array column

2015-11-05 Thread James Taylor (JIRA)

[ 
https://issues.apache.org/jira/browse/PHOENIX-2301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=14991788#comment-14991788
 ] 

James Taylor commented on PHOENIX-2301:
---

I see - so there's no NPE? Let's rename the JIRA summary then. We don't
enforce any array size constraints, so let's not add that check. Your
original idea of skipping the check for array types is fine (as long as
we're validating the individual element constraint).


> 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
>Assignee: Dumindu Buddhika
> Attachments: PHOENIX-2301.patch
>
>
> Attempting to upsert into a char array causes an NPE. Minimum example:
> {code:sql}
> 0: jdbc:phoenix:xx> 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:xx> UPSERT INTO TEST VALUES (ARRAY[1, 2, 3]);
> 1 row affected (0.184 seconds)
> 0: jdbc:phoenix:xx> SELECT * FROM TEST;
> +--+
> |   testIntArray   |
> +--+
> | [1, 2, 3]|
> +--+
> 1 row selected (0.308 seconds)
> 0: jdbc:phoenix:xx> DROP TABLE IF EXISTS TEST;
> No rows affected (3.348 seconds)
> 0: jdbc:phoenix:xx> 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:xx> 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:xx> SELECT * FROM TEST;
> +---+
> | testCharArray |
> +---+
> +---+
> No rows selected (0.169 seconds)
> 0: jdbc:phoenix:xx> SELECT "testCharArray" FROM TEST;
> +---+
> | testCharArray |
> +---+
> +---+
> No rows selected (0.182 seconds)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (PHOENIX-2301) NullPointerException when upserting into a char array column

2015-11-04 Thread James Taylor (JIRA)

[ 
https://issues.apache.org/jira/browse/PHOENIX-2301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=14989159#comment-14989159
 ] 

James Taylor commented on PHOENIX-2301:
---

Thanks, [~Dumindux]. So byteValue is null then? Also, what happens if one of 
the array element values is less than the max length, like this?
{code}
+props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 30));
+conn = DriverManager.getConnection(getUrl(), props);
+PreparedStatement stmt = conn.prepareStatement("UPSERT INTO TEST5 
VALUES (ARRAY['aa', 'bb', 'cc'])");
+stmt.execute();
{code}
And also the reverse - if one of the array elements values is bigger than the 
max length? Do we get an exception?

These would be good to add tests for if we don't have them yet.

> 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
>Assignee: Dumindu Buddhika
> Attachments: PHOENIX-2301.patch
>
>
> Attempting to upsert into a char array causes an NPE. Minimum example:
> {code:sql}
> 0: jdbc:phoenix:xx> 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:xx> UPSERT INTO TEST VALUES (ARRAY[1, 2, 3]);
> 1 row affected (0.184 seconds)
> 0: jdbc:phoenix:xx> SELECT * FROM TEST;
> +--+
> |   testIntArray   |
> +--+
> | [1, 2, 3]|
> +--+
> 1 row selected (0.308 seconds)
> 0: jdbc:phoenix:xx> DROP TABLE IF EXISTS TEST;
> No rows affected (3.348 seconds)
> 0: jdbc:phoenix:xx> 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:xx> 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:xx> SELECT * FROM TEST;
> +---+
> | testCharArray |
> +---+
> +---+
> No rows selected (0.169 seconds)
> 0: jdbc:phoenix:xx> SELECT "testCharArray" FROM TEST;
> +---+
> | testCharArray |
> +---+
> +---+
> No rows selected (0.182 seconds)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (PHOENIX-2301) NullPointerException when upserting into a char array column

2015-11-02 Thread James Taylor (JIRA)

[ 
https://issues.apache.org/jira/browse/PHOENIX-2301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=14984909#comment-14984909
 ] 

James Taylor commented on PHOENIX-2301:
---

[~Dumindux] - I believe this may be fixed and a duplicate of PHOENIX-2304. If 
you have a few spare cycles and can confirm, that'd be great.

> 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
>Assignee: Dumindu Buddhika
>
> Attempting to upsert into a char array causes an NPE. Minimum example:
> {code:sql}
> 0: jdbc:phoenix:xx> 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:xx> UPSERT INTO TEST VALUES (ARRAY[1, 2, 3]);
> 1 row affected (0.184 seconds)
> 0: jdbc:phoenix:xx> SELECT * FROM TEST;
> +--+
> |   testIntArray   |
> +--+
> | [1, 2, 3]|
> +--+
> 1 row selected (0.308 seconds)
> 0: jdbc:phoenix:xx> DROP TABLE IF EXISTS TEST;
> No rows affected (3.348 seconds)
> 0: jdbc:phoenix:xx> 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:xx> 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:xx> SELECT * FROM TEST;
> +---+
> | testCharArray |
> +---+
> +---+
> No rows selected (0.169 seconds)
> 0: jdbc:phoenix:xx> SELECT "testCharArray" FROM TEST;
> +---+
> | testCharArray |
> +---+
> +---+
> No rows selected (0.182 seconds)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (PHOENIX-2301) NullPointerException when upserting into a char array column

2015-10-07 Thread Julian Jaffe (JIRA)

[ 
https://issues.apache.org/jira/browse/PHOENIX-2301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=14947746#comment-14947746
 ] 

Julian Jaffe commented on PHOENIX-2301:
---

This bug also applies to the BINARY type:

{code:SQL}
0: jdbc:phoenix:xx> CREATE TABLE IF NOT EXISTS TEST.TEST("testBinArray" 
BINARY(3)[] constraint "test_pk" PRIMARY KEY ("testBinArray")) 
DEFAULT_COLUMN_FAMILY='TT', SALT_BUCKETS=10;
No rows affected (1.16 seconds)
0: jdbc:phoenix:xx> UPSERT INTO TEST.TEST VALUES(ARRAY[1, 0]);
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.PBinaryArray.toObject(PBinaryArray.java:63)
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:xx> SELECT * FROM TEST.TEST;
+--+
| testBinArray |
+--+
+--+
No rows selected (0.179 seconds)
{code}.

It appears to be due to the fact that both PChar and PBinary return true for 
isFixedWidth() but null for getByteSize(), while all other non-array types 
return a byteSize.

> 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:xx> 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:xx> UPSERT INTO TEST VALUES (ARRAY[1, 2, 3]);
> 1 row affected (0.184 seconds)
> 0: jdbc:phoenix:xx> SELECT * FROM TEST;
> +--+
> |   testIntArray   |
> +--+
> | [1, 2, 3]|
> +--+
> 1 row selected (0.308 seconds)
> 0: jdbc:phoenix:xx> DROP TABLE IF EXISTS TEST;
> No rows affected (3.348 seconds)
> 0: jdbc:phoenix:xx> 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:xx> 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 

[jira] [Commented] (PHOENIX-2301) NullPointerException when upserting into a char array column

2015-10-06 Thread Julian Jaffe (JIRA)

[ 
https://issues.apache.org/jira/browse/PHOENIX-2301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=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:xx> UPSERT INTO TEST.TEST VALUES(5, ARRAY['aaa','bbb']);
1 row affected (0.164 seconds)
0: jdbc:phoenix:xx> SELECT * FROM TEST.TEST;
+--+---+
| testInt  | testCharArray |
+--+---+
| 5| ['aaa', 'bbb'] |
+--+---+
1 row selected (0.364 seconds)
0: jdbc:phoenix:xx> 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:xx> 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:xx> UPSERT INTO TEST VALUES (ARRAY[1, 2, 3]);
> 1 row affected (0.184 seconds)
> 0: jdbc:phoenix:xx> SELECT * FROM TEST;
> +--+
> |   testIntArray   |
> +--+
> | [1, 2, 3]|
> +--+
> 1 row selected (0.308 seconds)
> 0: jdbc:phoenix:xx> DROP TABLE IF EXISTS TEST;
> No rows affected (3.348 seconds)
> 0: jdbc:phoenix:xx> 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:xx> 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)
>

[jira] [Commented] (PHOENIX-2301) NullPointerException when upserting into a char array column

2015-10-03 Thread Dumindu Buddhika (JIRA)

[ 
https://issues.apache.org/jira/browse/PHOENIX-2301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=14942547#comment-14942547
 ] 

Dumindu Buddhika commented on PHOENIX-2301:
---

[~jamestaylor] I wouldnt be able to take a look at this soon as I am going 
through my semester end exams.

> 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:xx> 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:xx> UPSERT INTO TEST VALUES (ARRAY[1, 2, 3]);
> 1 row affected (0.184 seconds)
> 0: jdbc:phoenix:xx> SELECT * FROM TEST;
> +--+
> |   testIntArray   |
> +--+
> | [1, 2, 3]|
> +--+
> 1 row selected (0.308 seconds)
> 0: jdbc:phoenix:xx> DROP TABLE IF EXISTS TEST;
> No rows affected (3.348 seconds)
> 0: jdbc:phoenix:xx> 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:xx> 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:xx> SELECT * FROM TEST;
> +---+
> | testCharArray |
> +---+
> +---+
> No rows selected (0.169 seconds)
> 0: jdbc:phoenix:xx> SELECT "testCharArray" FROM TEST;
> +---+
> | testCharArray |
> +---+
> +---+
> No rows selected (0.182 seconds)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (PHOENIX-2301) NullPointerException when upserting into a char array column

2015-10-01 Thread James Taylor (JIRA)

[ 
https://issues.apache.org/jira/browse/PHOENIX-2301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=14940759#comment-14940759
 ] 

James Taylor commented on PHOENIX-2301:
---

[~jja...@marinsoftware.com] - what version of Phoenix are you currently using?

[~Dumindux] - do you think you'd have a few spare cycles to take a look?

> 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
>Reporter: Julian Jaffe
>
> Attempting to upsert into a char array causes an NPE. Minimum example:
> {code:sql}
> 0: jdbc:phoenix:xx> 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:xx> UPSERT INTO TEST VALUES (ARRAY[1, 2, 3]);
> 1 row affected (0.184 seconds)
> 0: jdbc:phoenix:xx> SELECT * FROM TEST;
> +--+
> |   testIntArray   |
> +--+
> | [1, 2, 3]|
> +--+
> 1 row selected (0.308 seconds)
> 0: jdbc:phoenix:xx> DROP TABLE IF EXISTS TEST;
> No rows affected (3.348 seconds)
> 0: jdbc:phoenix:xx> 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:xx> 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:xx> SELECT * FROM TEST;
> +---+
> | testCharArray |
> +---+
> +---+
> No rows selected (0.169 seconds)
> 0: jdbc:phoenix:xx> SELECT "testCharArray" FROM TEST;
> +---+
> | testCharArray |
> +---+
> +---+
> No rows selected (0.182 seconds)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)