[jira] [Updated] (PHOENIX-3348) SELECT DISTINCT with a non-rowkey array and another column returns incorrect results

2016-10-04 Thread Julian Jaffe (JIRA)

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

Julian Jaffe updated PHOENIX-3348:
--
Summary: SELECT DISTINCT with a non-rowkey array and another column returns 
incorrect results  (was: SELECT DISTINCT with a non-rowkey array and an id 
returns incorrect results)

> SELECT DISTINCT with a non-rowkey array and another column returns incorrect 
> results
> 
>
> Key: PHOENIX-3348
> URL: https://issues.apache.org/jira/browse/PHOENIX-3348
> Project: Phoenix
>  Issue Type: Bug
>Affects Versions: 4.6.0
>Reporter: Julian Jaffe
>
> Attempting to select distinct combinations from an array and another column 
> returns incorrect results if the columns are not part of the primary key.
> {code:sql}
> CREATE TABLE IF NOT EXISTS TEST.DESERTEST (COLONE BIGINT NOT NULL PRIMARY 
> KEY, COLTWO BIGINT, COLTHREE BIGINT[]);
> No rows affected (1.368 seconds)
> UPSERT INTO TEST.DESERTEST VALUES (10, 7, ARRAY[1,2]);
> 1 row affected (0.161 seconds)
> SELECT DISTINCT COLTWO, COLTHREE FROM TEST.DESERTEST WHERE COLONE = 10;
> +--+--+
> |  COLTWO  | COLTHREE 
> |
> +--+--+
> | -9223372036854677504 | []   
> |
> +--+--+
> 1 row selected (0.367 seconds)
> SELECT COLTWO, COLTHREE FROM TEST.DESERTEST WHERE COLONE = 10;
> +--+--+
> |  COLTWO  | COLTHREE 
> |
> +--+--+
> | 7| [1, 2]   
> |
> +--+--+
> 1 row selected (0.336 seconds)
> SELECT DISTINCT COLONE, COLTHREE FROM TEST.DESERTEST WHERE COLONE = 10;
> +--+--+
> |  COLONE  | COLTHREE 
> |
> +--+--+
> | 10   | [1, 2]   
> |
> +--+--+
> 1 row selected (0.32 seconds)
> {code}
> We've confirmed this bug in 4.6, and confirmed that it does not occur in 4.8, 
> although I haven't been able to locate a corresponding JIRA. However, it will 
> occur if using the 4.6 client to talk to 4.8, so it appears to be at least 
> partially client-side.



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


[jira] [Updated] (PHOENIX-3297) Combining an RVC query and a filter on a datatype smaller than 8 bytes causes an Illegal Data Exception

2016-10-04 Thread Julian Jaffe (JIRA)

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

Julian Jaffe updated PHOENIX-3297:
--
Affects Version/s: 4.8.0

> Combining an RVC query and a filter on a datatype smaller than 8 bytes causes 
> an Illegal Data Exception
> ---
>
> Key: PHOENIX-3297
> URL: https://issues.apache.org/jira/browse/PHOENIX-3297
> Project: Phoenix
>  Issue Type: Bug
>Affects Versions: 4.6.0, 4.8.0
>Reporter: Julian Jaffe
>
> Combining an RVC query and a filter on a primary key column with a datatype 
> smaller than 8 bytes causes an Illegal Data Exception.
> {code:sql}0: jdbc:phoenix:> CREATE TABLE IF NOT EXISTS TEST.RVC_TEST 
> (COLONE BIGINT NOT NULL, COLTWO BIGINT NOT NULL, COLTHREE TINYINT NOT NULL, 
> COLFOUR BIGINT NOT NULL, COLFIVE VARCHAR, CONSTRAINT "test_pk" PRIMARY KEY 
> (COLONE, COLTWO, COLTHREE, COLFOUR));
> No rows affected (1.167 seconds)
> 0: jdbc:phoenix:> 
> 0: jdbc:phoenix:> UPSERT INTO TEST.RVC_TEST VALUES (1, 2, 3, 4, 'row 1');
> 1 row affected (0.169 seconds)
> 0: jdbc:phoenix:labs-darth-journalnode-lv-102> 
> 0: jdbc:phoenix:labs-darth-journalnode-lv-102> SELECT * FROM TEST.RVC_TEST 
> WHERE (COLONE, COLTWO) IN (1,2) AND COLTHREE=3;
> Error: ERROR 201 (22000): Illegal data. Expected length of at least 8 bytes, 
> but had 1 (state=22000,code=201)
> java.sql.SQLException: ERROR 201 (22000): Illegal data. Expected length of at 
> least 8 bytes, but had 1
>   at 
> org.apache.phoenix.exception.SQLExceptionCode$Factory$1.newException(SQLExceptionCode.java:396)
>   at 
> org.apache.phoenix.exception.SQLExceptionInfo.buildException(SQLExceptionInfo.java:145)
>   at 
> org.apache.phoenix.schema.types.PDataType.checkForSufficientLength(PDataType.java:273)
>   at 
> org.apache.phoenix.schema.types.PLong$LongCodec.decodeLong(PLong.java:229)
>   at org.apache.phoenix.schema.types.PLong.toObject(PLong.java:114)
>   at org.apache.phoenix.schema.types.PLong.toObject(PLong.java:30)
>   at 
> org.apache.phoenix.schema.types.PDataType.toObject(PDataType.java:967)
>   at 
> org.apache.phoenix.schema.types.PDataType.toObject(PDataType.java:971)
>   at 
> org.apache.phoenix.schema.types.PDataType.toObject(PDataType.java:1000)
>   at 
> org.apache.phoenix.schema.types.PDataType.toStringLiteral(PDataType.java:1073)
>   at 
> org.apache.phoenix.schema.types.PDataType.toStringLiteral(PDataType.java:1069)
>   at 
> org.apache.phoenix.iterate.ExplainTable.appendPKColumnValue(ExplainTable.java:194)
>   at 
> org.apache.phoenix.iterate.ExplainTable.appendScanRow(ExplainTable.java:270)
>   at 
> org.apache.phoenix.iterate.ExplainTable.appendKeyRanges(ExplainTable.java:282)
>   at 
> org.apache.phoenix.iterate.ExplainTable.explain(ExplainTable.java:125)
>   at 
> org.apache.phoenix.iterate.BaseResultIterators.explain(BaseResultIterators.java:728)
>   at 
> org.apache.phoenix.iterate.RoundRobinResultIterator.explain(RoundRobinResultIterator.java:153)
>   at 
> org.apache.phoenix.execute.BaseQueryPlan.getPlanSteps(BaseQueryPlan.java:438)
>   at 
> org.apache.phoenix.execute.BaseQueryPlan.iterator(BaseQueryPlan.java:295)
>   at 
> org.apache.phoenix.execute.BaseQueryPlan.iterator(BaseQueryPlan.java:176)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:268)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:258)
>   at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:257)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1438)
>   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)
> {code}
> I wasn't able to find any other Phoenix issues directly related to this, but 
> it seems that PHOENIX-2942 and PHOENIX-2980 may be related.



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


[jira] [Created] (PHOENIX-3348) SELECT DISTINCT with a non-rowkey array and an id returns incorrect results

2016-10-04 Thread Julian Jaffe (JIRA)
Julian Jaffe created PHOENIX-3348:
-

 Summary: SELECT DISTINCT with a non-rowkey array and an id returns 
incorrect results
 Key: PHOENIX-3348
 URL: https://issues.apache.org/jira/browse/PHOENIX-3348
 Project: Phoenix
  Issue Type: Bug
Affects Versions: 4.6.0
Reporter: Julian Jaffe


Attempting to select distinct combinations from an array and another column 
returns incorrect results if the columns are not part of the primary key.

{code:sql}
CREATE TABLE IF NOT EXISTS TEST.DESERTEST (COLONE BIGINT NOT NULL PRIMARY KEY, 
COLTWO BIGINT, COLTHREE BIGINT[]);
No rows affected (1.368 seconds)

UPSERT INTO TEST.DESERTEST VALUES (10, 7, ARRAY[1,2]);
1 row affected (0.161 seconds)

SELECT DISTINCT COLTWO, COLTHREE FROM TEST.DESERTEST WHERE COLONE = 10;
+--+--+
|  COLTWO  | COLTHREE   
  |
+--+--+
| -9223372036854677504 | [] 
  |
+--+--+
1 row selected (0.367 seconds)

SELECT COLTWO, COLTHREE FROM TEST.DESERTEST WHERE COLONE = 10;
+--+--+
|  COLTWO  | COLTHREE   
  |
+--+--+
| 7| [1, 2] 
  |
+--+--+
1 row selected (0.336 seconds)

SELECT DISTINCT COLONE, COLTHREE FROM TEST.DESERTEST WHERE COLONE = 10;
+--+--+
|  COLONE  | COLTHREE   
  |
+--+--+
| 10   | [1, 2] 
  |
+--+--+
1 row selected (0.32 seconds)
{code}

We've confirmed this bug in 4.6, and confirmed that it does not occur in 4.8, 
although I haven't been able to locate a corresponding JIRA. However, it will 
occur if using the 4.6 client to talk to 4.8, so it appears to be at least 
partially client-side.



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


[jira] [Commented] (PHOENIX-3297) Combining an RVC query and a filter on a datatype smaller than 8 bytes causes an Illegal Data Exception

2016-09-19 Thread Julian Jaffe (JIRA)

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

Julian Jaffe commented on PHOENIX-3297:
---

Upon further investigation, the provided example succeeds if the select 
statement is changed to {code:sql}SELECT * FROM TEST.RVC_TEST WHERE (COLONE, 
COLTWO) IN ((1,2)) AND COLTHREE=3;{code} (with an extra set of parentheses 
around the RVC composite), but will fail with same error if a second composite 
is added (e.g. {code:sql}SELECT * FROM TEST.RVC_TEST WHERE (COLONE, COLTWO) IN 
((1,2), (1,2)) AND COLTHREE=3;
Error: ERROR 201 (22000): Illegal data. Expected length of at least 8 bytes, 
but had 1 (state=22000,code=201)
java.sql.SQLException: ERROR 201 (22000): Illegal data. Expected length of at 
least 8 bytes, but had 1
at 
org.apache.phoenix.exception.SQLExceptionCode$Factory$1.newException(SQLExceptionCode.java:396)
at 
org.apache.phoenix.exception.SQLExceptionInfo.buildException(SQLExceptionInfo.java:145)
at 
org.apache.phoenix.schema.types.PDataType.checkForSufficientLength(PDataType.java:273)
at 
org.apache.phoenix.schema.types.PLong$LongCodec.decodeLong(PLong.java:229)
at org.apache.phoenix.schema.types.PLong.toObject(PLong.java:114)
at org.apache.phoenix.schema.types.PLong.toObject(PLong.java:30)
at 
org.apache.phoenix.schema.types.PDataType.toObject(PDataType.java:967)
at 
org.apache.phoenix.schema.types.PDataType.toObject(PDataType.java:971)
at 
org.apache.phoenix.schema.types.PDataType.toObject(PDataType.java:1000)
at 
org.apache.phoenix.schema.types.PDataType.toStringLiteral(PDataType.java:1073)
at 
org.apache.phoenix.schema.types.PDataType.toStringLiteral(PDataType.java:1069)
at 
org.apache.phoenix.iterate.ExplainTable.appendPKColumnValue(ExplainTable.java:194)
at 
org.apache.phoenix.iterate.ExplainTable.appendScanRow(ExplainTable.java:270)
at 
org.apache.phoenix.iterate.ExplainTable.appendKeyRanges(ExplainTable.java:282)
at 
org.apache.phoenix.iterate.ExplainTable.explain(ExplainTable.java:125)
at 
org.apache.phoenix.iterate.BaseResultIterators.explain(BaseResultIterators.java:728)
at 
org.apache.phoenix.iterate.RoundRobinResultIterator.explain(RoundRobinResultIterator.java:153)
at 
org.apache.phoenix.execute.BaseQueryPlan.getPlanSteps(BaseQueryPlan.java:438)
at 
org.apache.phoenix.execute.BaseQueryPlan.iterator(BaseQueryPlan.java:295)
at 
org.apache.phoenix.execute.BaseQueryPlan.iterator(BaseQueryPlan.java:176)
at 
org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:268)
at 
org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:258)
at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
at 
org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:257)
at 
org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1438)
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){code}).

> Combining an RVC query and a filter on a datatype smaller than 8 bytes causes 
> an Illegal Data Exception
> ---
>
> Key: PHOENIX-3297
> URL: https://issues.apache.org/jira/browse/PHOENIX-3297
> Project: Phoenix
>  Issue Type: Bug
>Affects Versions: 4.6.0
>Reporter: Julian Jaffe
>
> Combining an RVC query and a filter on a primary key column with a datatype 
> smaller than 8 bytes causes an Illegal Data Exception.
> {code:sql}0: jdbc:phoenix:> CREATE TABLE IF NOT EXISTS TEST.RVC_TEST 
> (COLONE BIGINT NOT NULL, COLTWO BIGINT NOT NULL, COLTHREE TINYINT NOT NULL, 
> COLFOUR BIGINT NOT NULL, COLFIVE VARCHAR, CONSTRAINT "test_pk" PRIMARY KEY 
> (COLONE, COLTWO, COLTHREE, COLFOUR));
> No rows affected (1.167 seconds)
> 0: jdbc:phoenix:> 
> 0: jdbc:phoenix:> UPSERT INTO TEST.RVC_TEST VALUES (1, 2, 3, 4, 'row 1');
> 1 row affected (0.169 seconds)
> 0: jdbc:phoenix:labs-darth-journalnode-lv-102> 
> 0: jdbc:phoenix:labs-darth-journalnode-lv-102> SELECT * FROM TEST.RVC_TEST 
> WHERE (COLONE, COLTWO) IN (1,2) AND COLTHREE=3;
> Error: ERROR 201 (22000): Illegal data. Expected length of at least 8 bytes, 
> but had 1 (state=22000,code=201)
> java.sql.SQLException: ERROR 201 (22000): Illegal data. Expected length of at 
> least 8 bytes, but had 1
>   at 
> org.apache.phoenix.exception.SQLExceptionCode$Factory$1.newException(SQLExceptionCode.java:396)
>   at 
> 

[jira] [Created] (PHOENIX-3297) Combining an RVC query and a filter on a datatype smaller than 8 bytes causes an Illegal Data Exception

2016-09-19 Thread Julian Jaffe (JIRA)
Julian Jaffe created PHOENIX-3297:
-

 Summary: Combining an RVC query and a filter on a datatype smaller 
than 8 bytes causes an Illegal Data Exception
 Key: PHOENIX-3297
 URL: https://issues.apache.org/jira/browse/PHOENIX-3297
 Project: Phoenix
  Issue Type: Bug
Affects Versions: 4.6.0
Reporter: Julian Jaffe


Combining an RVC query and a filter on a primary key column with a datatype 
smaller than 8 bytes causes an Illegal Data Exception.

{code:sql}0: jdbc:phoenix:> CREATE TABLE IF NOT EXISTS TEST.RVC_TEST 
(COLONE BIGINT NOT NULL, COLTWO BIGINT NOT NULL, COLTHREE TINYINT NOT NULL, 
COLFOUR BIGINT NOT NULL, COLFIVE VARCHAR, CONSTRAINT "test_pk" PRIMARY KEY 
(COLONE, COLTWO, COLTHREE, COLFOUR));
No rows affected (1.167 seconds)
0: jdbc:phoenix:> 
0: jdbc:phoenix:> UPSERT INTO TEST.RVC_TEST VALUES (1, 2, 3, 4, 'row 1');
1 row affected (0.169 seconds)
0: jdbc:phoenix:labs-darth-journalnode-lv-102> 
0: jdbc:phoenix:labs-darth-journalnode-lv-102> SELECT * FROM TEST.RVC_TEST 
WHERE (COLONE, COLTWO) IN (1,2) AND COLTHREE=3;
Error: ERROR 201 (22000): Illegal data. Expected length of at least 8 bytes, 
but had 1 (state=22000,code=201)
java.sql.SQLException: ERROR 201 (22000): Illegal data. Expected length of at 
least 8 bytes, but had 1
at 
org.apache.phoenix.exception.SQLExceptionCode$Factory$1.newException(SQLExceptionCode.java:396)
at 
org.apache.phoenix.exception.SQLExceptionInfo.buildException(SQLExceptionInfo.java:145)
at 
org.apache.phoenix.schema.types.PDataType.checkForSufficientLength(PDataType.java:273)
at 
org.apache.phoenix.schema.types.PLong$LongCodec.decodeLong(PLong.java:229)
at org.apache.phoenix.schema.types.PLong.toObject(PLong.java:114)
at org.apache.phoenix.schema.types.PLong.toObject(PLong.java:30)
at 
org.apache.phoenix.schema.types.PDataType.toObject(PDataType.java:967)
at 
org.apache.phoenix.schema.types.PDataType.toObject(PDataType.java:971)
at 
org.apache.phoenix.schema.types.PDataType.toObject(PDataType.java:1000)
at 
org.apache.phoenix.schema.types.PDataType.toStringLiteral(PDataType.java:1073)
at 
org.apache.phoenix.schema.types.PDataType.toStringLiteral(PDataType.java:1069)
at 
org.apache.phoenix.iterate.ExplainTable.appendPKColumnValue(ExplainTable.java:194)
at 
org.apache.phoenix.iterate.ExplainTable.appendScanRow(ExplainTable.java:270)
at 
org.apache.phoenix.iterate.ExplainTable.appendKeyRanges(ExplainTable.java:282)
at 
org.apache.phoenix.iterate.ExplainTable.explain(ExplainTable.java:125)
at 
org.apache.phoenix.iterate.BaseResultIterators.explain(BaseResultIterators.java:728)
at 
org.apache.phoenix.iterate.RoundRobinResultIterator.explain(RoundRobinResultIterator.java:153)
at 
org.apache.phoenix.execute.BaseQueryPlan.getPlanSteps(BaseQueryPlan.java:438)
at 
org.apache.phoenix.execute.BaseQueryPlan.iterator(BaseQueryPlan.java:295)
at 
org.apache.phoenix.execute.BaseQueryPlan.iterator(BaseQueryPlan.java:176)
at 
org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:268)
at 
org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:258)
at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
at 
org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:257)
at 
org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1438)
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)
{code}

I wasn't able to find any other Phoenix issues directly related to this, but it 
seems that PHOENIX-2942 and PHOENIX-2980 may be related.



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


[jira] [Commented] (PHOENIX-2402) NPE when using UPSERT SELECT with a char array

2015-11-11 Thread Julian Jaffe (JIRA)

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

Julian Jaffe commented on PHOENIX-2402:
---

Patch uploaded

> NPE when using UPSERT SELECT with a char array
> --
>
> Key: PHOENIX-2402
> URL: https://issues.apache.org/jira/browse/PHOENIX-2402
> Project: Phoenix
>  Issue Type: Bug
>Affects Versions: 4.5.2
>Reporter: Julian Jaffe
> Attachments: PHOENIX-2402.patch
>
>
> A NPE is thrown when attempting to UPSERT SELECT with a char array:
> {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}



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


[jira] [Updated] (PHOENIX-2402) NPE when using UPSERT SELECT with a char array

2015-11-11 Thread Julian Jaffe (JIRA)

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

Julian Jaffe updated PHOENIX-2402:
--
Attachment: PHOENIX-2402.patch

> NPE when using UPSERT SELECT with a char array
> --
>
> Key: PHOENIX-2402
> URL: https://issues.apache.org/jira/browse/PHOENIX-2402
> Project: Phoenix
>  Issue Type: Bug
>Affects Versions: 4.5.2
>Reporter: Julian Jaffe
> Attachments: PHOENIX-2402.patch
>
>
> A NPE is thrown when attempting to UPSERT SELECT with a char array:
> {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}



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


[jira] [Assigned] (PHOENIX-2402) NPE when using UPSERT SELECT with a char array

2015-11-11 Thread Julian Jaffe (JIRA)

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

Julian Jaffe reassigned PHOENIX-2402:
-

Assignee: Julian Jaffe

> NPE when using UPSERT SELECT with a char array
> --
>
> Key: PHOENIX-2402
> URL: https://issues.apache.org/jira/browse/PHOENIX-2402
> Project: Phoenix
>  Issue Type: Bug
>Affects Versions: 4.5.2
>Reporter: Julian Jaffe
>Assignee: Julian Jaffe
> Attachments: PHOENIX-2402.patch
>
>
> A NPE is thrown when attempting to UPSERT SELECT with a char array:
> {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}



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


[jira] [Created] (PHOENIX-2402) NPE when using UPSERT SELECT with a char array

2015-11-11 Thread Julian Jaffe (JIRA)
Julian Jaffe created PHOENIX-2402:
-

 Summary: NPE when using UPSERT SELECT with a char array
 Key: PHOENIX-2402
 URL: https://issues.apache.org/jira/browse/PHOENIX-2402
 Project: Phoenix
  Issue Type: Bug
Affects Versions: 4.5.2
Reporter: Julian Jaffe


A NPE is thrown when attempting to UPSERT SELECT with a char array:

{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}



--
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-2304) NullPointerException when using an index and a char array

2015-10-16 Thread Julian Jaffe (JIRA)

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

Julian Jaffe commented on PHOENIX-2304:
---

BINARY type does require the same fix, but that's all this bug needs.

> NullPointerException when using an index and a char array
> -
>
> Key: PHOENIX-2304
> URL: https://issues.apache.org/jira/browse/PHOENIX-2304
> Project: Phoenix
>  Issue Type: Bug
>Affects Versions: 4.5.2
>Reporter: Julian Jaffe
>
> An NPE occurs when Phoenix attempts to retrieve a char array from an index. 
> Retrieving other columns in the table is unaffected. Example below: 
> {code:sql}
> 0: jdbc:phoenix:xx> CREATE TABLE IF NOT EXISTS TEST.TEST("testInt" 
> INTEGER, "testCharArray" CHAR(3)[], CONSTRAINT "test_pk" PRIMARY 
> KEY("testInt")) DEFAULT_COLUMN_FAMILY='T';
> No rows affected (2.223 seconds)
> 0: jdbc:phoenix:xx> UPSERT INTO TEST.TEST VALUES (5, ARRAY['aaa', 'bbb']);
> 1 row affected (0.165 seconds)
> 0: jdbc:phoenix:xx> SELECT "testCharArray" FROM TEST.TEST;
> +---+
> | testCharArray |
> +---+
> | ['aaa', 'bbb'] |
> +---+
> 1 row selected (0.183 seconds)
> 0: jdbc:phoenix:xx> CREATE INDEX IF NOT EXISTS TEST_INDEX ON TEST.TEST 
> ("testInt") INCLUDE ("testCharArray");
> 1 row affected (10.331 seconds)
> 0: jdbc:phoenix:xx> EXPLAIN SELECT "testCharArray" FROM TEST.TEST;
> +--+
> |   PLAN   |
> +--+
> | CLIENT 1-CHUNK PARALLEL 1-WAY FULL SCAN OVER TEST.TEST |
> +--+
> 1 row selected (0.173 seconds)
> 0: jdbc:phoenix:xx> SELECT "testCharArray" FROM TEST.TEST;
> +---+
> | testCharArray |
> +---+
> | ['aaa', 'bbb'] |
> +---+
> 1 row selected (0.475 seconds)
> 0: jdbc:phoenix:xx> EXPLAIN SELECT /*+ INDEX(TEST.TEST TEST_INDEX)*/ 
> "testCharArray" FROM TEST.TEST;
> +--+
> |   PLAN   |
> +--+
> | CLIENT 1-CHUNK PARALLEL 1-WAY FULL SCAN OVER TEST.TEST_INDEX |
> +--+
> 1 row selected (0.186 seconds)
> 0: jdbc:phoenix:xx> SELECT /*+ INDEX(TEST.TEST TEST_INDEX)*/ 
> "testCharArray" FROM TEST.TEST;
> +--+
> |  testCharArray   |
> +--+
> 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:984)
>   at 
> org.apache.phoenix.compile.ExpressionProjector.getValue(ExpressionProjector.java:75)
>   at 
> org.apache.phoenix.jdbc.PhoenixResultSet.getString(PhoenixResultSet.java:603)
>   at sqlline.Rows$Row.(Rows.java:183)
>   at sqlline.IncrementalRows.hasNext(IncrementalRows.java:63)
>   at sqlline.TableOutputFormat.print(TableOutputFormat.java:33)
>   at sqlline.SqlLine.print(SqlLine.java:1653)
>   at sqlline.Commands.execute(Commands.java:833)
>   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> CREATE INDEX IF NOT EXISTS TEST2 ON TEST.TEST 
> ("testInt", "testCharArray");
> 1 row affected (2.098 seconds)
> 0: jdbc:phoenix:xx> EXPLAIN SELECT /*+ INDEX(TEST.TEST TEST2) */ 
> "testCharArray" FROM TEST.TEST;
> +--+
> |   PLAN   |
> +--+
> | CLIENT 1-CHUNK PARALLEL 1-WAY FULL SCAN OVER TEST.TEST2 |
> | SERVER FILTER BY FIRST KEY ONLY  |
> +--+
> 2 rows selected (0.189 seconds)
> 0: jdbc:phoenix:xx> SELECT /*+ INDEX(TEST.TEST TEST2) */ "testCharArray" 
> FROM TEST.TEST;
> +--+
> |  testCharArray   |
> +--+
> 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)
>   

[jira] [Updated] (PHOENIX-2304) NullPointerException when using an index and a char array

2015-10-16 Thread Julian Jaffe (JIRA)

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

Julian Jaffe updated PHOENIX-2304:
--
Attachment: Index.diff

Other types (for example, Integers) are also fixed-width but should not be 
affected, while varchar and varbinary are not fixed width but need the handling 
code, so I left the current if/else block.

> NullPointerException when using an index and a char array
> -
>
> Key: PHOENIX-2304
> URL: https://issues.apache.org/jira/browse/PHOENIX-2304
> Project: Phoenix
>  Issue Type: Bug
>Affects Versions: 4.5.2
>Reporter: Julian Jaffe
>
> An NPE occurs when Phoenix attempts to retrieve a char array from an index. 
> Retrieving other columns in the table is unaffected. Example below: 
> {code:sql}
> 0: jdbc:phoenix:xx> CREATE TABLE IF NOT EXISTS TEST.TEST("testInt" 
> INTEGER, "testCharArray" CHAR(3)[], CONSTRAINT "test_pk" PRIMARY 
> KEY("testInt")) DEFAULT_COLUMN_FAMILY='T';
> No rows affected (2.223 seconds)
> 0: jdbc:phoenix:xx> UPSERT INTO TEST.TEST VALUES (5, ARRAY['aaa', 'bbb']);
> 1 row affected (0.165 seconds)
> 0: jdbc:phoenix:xx> SELECT "testCharArray" FROM TEST.TEST;
> +---+
> | testCharArray |
> +---+
> | ['aaa', 'bbb'] |
> +---+
> 1 row selected (0.183 seconds)
> 0: jdbc:phoenix:xx> CREATE INDEX IF NOT EXISTS TEST_INDEX ON TEST.TEST 
> ("testInt") INCLUDE ("testCharArray");
> 1 row affected (10.331 seconds)
> 0: jdbc:phoenix:xx> EXPLAIN SELECT "testCharArray" FROM TEST.TEST;
> +--+
> |   PLAN   |
> +--+
> | CLIENT 1-CHUNK PARALLEL 1-WAY FULL SCAN OVER TEST.TEST |
> +--+
> 1 row selected (0.173 seconds)
> 0: jdbc:phoenix:xx> SELECT "testCharArray" FROM TEST.TEST;
> +---+
> | testCharArray |
> +---+
> | ['aaa', 'bbb'] |
> +---+
> 1 row selected (0.475 seconds)
> 0: jdbc:phoenix:xx> EXPLAIN SELECT /*+ INDEX(TEST.TEST TEST_INDEX)*/ 
> "testCharArray" FROM TEST.TEST;
> +--+
> |   PLAN   |
> +--+
> | CLIENT 1-CHUNK PARALLEL 1-WAY FULL SCAN OVER TEST.TEST_INDEX |
> +--+
> 1 row selected (0.186 seconds)
> 0: jdbc:phoenix:xx> SELECT /*+ INDEX(TEST.TEST TEST_INDEX)*/ 
> "testCharArray" FROM TEST.TEST;
> +--+
> |  testCharArray   |
> +--+
> 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:984)
>   at 
> org.apache.phoenix.compile.ExpressionProjector.getValue(ExpressionProjector.java:75)
>   at 
> org.apache.phoenix.jdbc.PhoenixResultSet.getString(PhoenixResultSet.java:603)
>   at sqlline.Rows$Row.(Rows.java:183)
>   at sqlline.IncrementalRows.hasNext(IncrementalRows.java:63)
>   at sqlline.TableOutputFormat.print(TableOutputFormat.java:33)
>   at sqlline.SqlLine.print(SqlLine.java:1653)
>   at sqlline.Commands.execute(Commands.java:833)
>   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> CREATE INDEX IF NOT EXISTS TEST2 ON TEST.TEST 
> ("testInt", "testCharArray");
> 1 row affected (2.098 seconds)
> 0: jdbc:phoenix:xx> EXPLAIN SELECT /*+ INDEX(TEST.TEST TEST2) */ 
> "testCharArray" FROM TEST.TEST;
> +--+
> |   PLAN   |
> +--+
> | CLIENT 1-CHUNK PARALLEL 1-WAY FULL SCAN OVER TEST.TEST2 |
> | SERVER FILTER BY FIRST KEY ONLY  |
> +--+
> 2 rows selected (0.189 seconds)
> 0: jdbc:phoenix:xx> SELECT /*+ INDEX(TEST.TEST TEST2) */ "testCharArray" 
> FROM TEST.TEST;
> +--+
> |  testCharArray   |
> +--+
> java.lang.NullPointerException
>   at 
> org.apache.phoenix.schema.types.PArrayDataType.createPhoenixArray(PArrayDataType.java:1123)
>   at 
> 

[jira] [Updated] (PHOENIX-2304) NullPointerException when using an index and a char array

2015-10-16 Thread Julian Jaffe (JIRA)

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

Julian Jaffe updated PHOENIX-2304:
--
Attachment: PHOENIX-2402.patch

> NullPointerException when using an index and a char array
> -
>
> Key: PHOENIX-2304
> URL: https://issues.apache.org/jira/browse/PHOENIX-2304
> Project: Phoenix
>  Issue Type: Bug
>Affects Versions: 4.5.2
>Reporter: Julian Jaffe
> Attachments: PHOENIX-2402.patch
>
>
> An NPE occurs when Phoenix attempts to retrieve a char array from an index. 
> Retrieving other columns in the table is unaffected. Example below: 
> {code:sql}
> 0: jdbc:phoenix:xx> CREATE TABLE IF NOT EXISTS TEST.TEST("testInt" 
> INTEGER, "testCharArray" CHAR(3)[], CONSTRAINT "test_pk" PRIMARY 
> KEY("testInt")) DEFAULT_COLUMN_FAMILY='T';
> No rows affected (2.223 seconds)
> 0: jdbc:phoenix:xx> UPSERT INTO TEST.TEST VALUES (5, ARRAY['aaa', 'bbb']);
> 1 row affected (0.165 seconds)
> 0: jdbc:phoenix:xx> SELECT "testCharArray" FROM TEST.TEST;
> +---+
> | testCharArray |
> +---+
> | ['aaa', 'bbb'] |
> +---+
> 1 row selected (0.183 seconds)
> 0: jdbc:phoenix:xx> CREATE INDEX IF NOT EXISTS TEST_INDEX ON TEST.TEST 
> ("testInt") INCLUDE ("testCharArray");
> 1 row affected (10.331 seconds)
> 0: jdbc:phoenix:xx> EXPLAIN SELECT "testCharArray" FROM TEST.TEST;
> +--+
> |   PLAN   |
> +--+
> | CLIENT 1-CHUNK PARALLEL 1-WAY FULL SCAN OVER TEST.TEST |
> +--+
> 1 row selected (0.173 seconds)
> 0: jdbc:phoenix:xx> SELECT "testCharArray" FROM TEST.TEST;
> +---+
> | testCharArray |
> +---+
> | ['aaa', 'bbb'] |
> +---+
> 1 row selected (0.475 seconds)
> 0: jdbc:phoenix:xx> EXPLAIN SELECT /*+ INDEX(TEST.TEST TEST_INDEX)*/ 
> "testCharArray" FROM TEST.TEST;
> +--+
> |   PLAN   |
> +--+
> | CLIENT 1-CHUNK PARALLEL 1-WAY FULL SCAN OVER TEST.TEST_INDEX |
> +--+
> 1 row selected (0.186 seconds)
> 0: jdbc:phoenix:xx> SELECT /*+ INDEX(TEST.TEST TEST_INDEX)*/ 
> "testCharArray" FROM TEST.TEST;
> +--+
> |  testCharArray   |
> +--+
> 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:984)
>   at 
> org.apache.phoenix.compile.ExpressionProjector.getValue(ExpressionProjector.java:75)
>   at 
> org.apache.phoenix.jdbc.PhoenixResultSet.getString(PhoenixResultSet.java:603)
>   at sqlline.Rows$Row.(Rows.java:183)
>   at sqlline.IncrementalRows.hasNext(IncrementalRows.java:63)
>   at sqlline.TableOutputFormat.print(TableOutputFormat.java:33)
>   at sqlline.SqlLine.print(SqlLine.java:1653)
>   at sqlline.Commands.execute(Commands.java:833)
>   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> CREATE INDEX IF NOT EXISTS TEST2 ON TEST.TEST 
> ("testInt", "testCharArray");
> 1 row affected (2.098 seconds)
> 0: jdbc:phoenix:xx> EXPLAIN SELECT /*+ INDEX(TEST.TEST TEST2) */ 
> "testCharArray" FROM TEST.TEST;
> +--+
> |   PLAN   |
> +--+
> | CLIENT 1-CHUNK PARALLEL 1-WAY FULL SCAN OVER TEST.TEST2 |
> | SERVER FILTER BY FIRST KEY ONLY  |
> +--+
> 2 rows selected (0.189 seconds)
> 0: jdbc:phoenix:xx> SELECT /*+ INDEX(TEST.TEST TEST2) */ "testCharArray" 
> FROM TEST.TEST;
> +--+
> |  testCharArray   |
> +--+
> 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 
> 

[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] [Comment Edited] (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 edited comment on PHOENIX-2301 at 10/8/15 12:14 AM:
-

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 fixed-width types 
return a byteSize.


was (Author: jja...@marinsoftware.com):
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 

[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] [Created] (PHOENIX-2304) NullPointerException when using an index and a char array

2015-10-02 Thread Julian Jaffe (JIRA)
Julian Jaffe created PHOENIX-2304:
-

 Summary: NullPointerException when using an index and a char array
 Key: PHOENIX-2304
 URL: https://issues.apache.org/jira/browse/PHOENIX-2304
 Project: Phoenix
  Issue Type: Bug
Affects Versions: 4.5.2
Reporter: Julian Jaffe


An NPE occurs when Phoenix attempts to retrieve a char array from an index. 
Retrieving other columns in the table is unaffected. Example below: 

{code:sql}
0: jdbc:phoenix:xx> CREATE TABLE IF NOT EXISTS TEST.TEST("testInt" INTEGER, 
"testCharArray" CHAR(3)[], CONSTRAINT "test_pk" PRIMARY KEY("testInt")) 
DEFAULT_COLUMN_FAMILY='T';
No rows affected (2.223 seconds)
0: jdbc:phoenix:xx> UPSERT INTO TEST.TEST VALUES (5, ARRAY['aaa', 'bbb']);
1 row affected (0.165 seconds)
0: jdbc:phoenix:xx> SELECT "testCharArray" FROM TEST.TEST;
+---+
| testCharArray |
+---+
| ['aaa', 'bbb'] |
+---+
1 row selected (0.183 seconds)
0: jdbc:phoenix:xx> CREATE INDEX IF NOT EXISTS TEST_INDEX ON TEST.TEST 
("testInt") INCLUDE ("testCharArray");
1 row affected (10.331 seconds)
0: jdbc:phoenix:xx> EXPLAIN SELECT "testCharArray" FROM TEST.TEST;
+--+
|   PLAN   |
+--+
| CLIENT 1-CHUNK PARALLEL 1-WAY FULL SCAN OVER TEST.TEST |
+--+
1 row selected (0.173 seconds)
0: jdbc:phoenix:xx> SELECT "testCharArray" FROM TEST.TEST;
+---+
| testCharArray |
+---+
| ['aaa', 'bbb'] |
+---+
1 row selected (0.475 seconds)
0: jdbc:phoenix:xx> EXPLAIN SELECT /*+ INDEX(TEST.TEST TEST_INDEX)*/ 
"testCharArray" FROM TEST.TEST;
+--+
|   PLAN   |
+--+
| CLIENT 1-CHUNK PARALLEL 1-WAY FULL SCAN OVER TEST.TEST_INDEX |
+--+
1 row selected (0.186 seconds)
0: jdbc:phoenix:xx> SELECT /*+ INDEX(TEST.TEST TEST_INDEX)*/ 
"testCharArray" FROM TEST.TEST;
+--+
|  testCharArray   |
+--+
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:984)
at 
org.apache.phoenix.compile.ExpressionProjector.getValue(ExpressionProjector.java:75)
at 
org.apache.phoenix.jdbc.PhoenixResultSet.getString(PhoenixResultSet.java:603)
at sqlline.Rows$Row.(Rows.java:183)
at sqlline.IncrementalRows.hasNext(IncrementalRows.java:63)
at sqlline.TableOutputFormat.print(TableOutputFormat.java:33)
at sqlline.SqlLine.print(SqlLine.java:1653)
at sqlline.Commands.execute(Commands.java:833)
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> CREATE INDEX IF NOT EXISTS TEST2 ON TEST.TEST 
("testInt", "testCharArray");
1 row affected (2.098 seconds)
0: jdbc:phoenix:xx> EXPLAIN SELECT /*+ INDEX(TEST.TEST TEST2) */ 
"testCharArray" FROM TEST.TEST;
+--+
|   PLAN   |
+--+
| CLIENT 1-CHUNK PARALLEL 1-WAY FULL SCAN OVER TEST.TEST2 |
| SERVER FILTER BY FIRST KEY ONLY  |
+--+
2 rows selected (0.189 seconds)
0: jdbc:phoenix:xx> SELECT /*+ INDEX(TEST.TEST TEST2) */ "testCharArray" 
FROM TEST.TEST;
+--+
|  testCharArray   |
+--+
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:984)
at 
org.apache.phoenix.compile.ExpressionProjector.getValue(ExpressionProjector.java:75)
at 
org.apache.phoenix.jdbc.PhoenixResultSet.getString(PhoenixResultSet.java:603)
at sqlline.Rows$Row.(Rows.java:183)
at sqlline.IncrementalRows.hasNext(IncrementalRows.java:63)
at 

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

2015-10-02 Thread Julian Jaffe (JIRA)

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

Julian Jaffe updated PHOENIX-2301:
--
Affects Version/s: 4.5.2

> 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] [Created] (PHOENIX-2301) NullPointerException when upserting into a char array column

2015-10-01 Thread Julian Jaffe (JIRA)
Julian Jaffe created PHOENIX-2301:
-

 Summary: 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)