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

ASF GitHub Bot commented on PHOENIX-2304:
-----------------------------------------

Github user navis commented on the pull request:

    https://github.com/apache/phoenix/pull/121#issuecomment-149186165
  
    Made two version of patches (a69735b and a20e123). 


> 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:xxxxxx> 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:xxxxxx> UPSERT INTO TEST.TEST VALUES (5, ARRAY['aaa', 'bbb']);
> 1 row affected (0.165 seconds)
> 0: jdbc:phoenix:xxxxxx> SELECT "testCharArray" FROM TEST.TEST;
> +---------------+
> | testCharArray |
> +---------------+
> | ['aaa', 'bbb'] |
> +---------------+
> 1 row selected (0.183 seconds)
> 0: jdbc:phoenix:xxxxxx> CREATE INDEX IF NOT EXISTS TEST_INDEX ON TEST.TEST 
> ("testInt") INCLUDE ("testCharArray");
> 1 row affected (10.331 seconds)
> 0: jdbc:phoenix:xxxxxx> 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:xxxxxx> SELECT "testCharArray" FROM TEST.TEST;
> +---------------+
> | testCharArray |
> +---------------+
> | ['aaa', 'bbb'] |
> +---------------+
> 1 row selected (0.475 seconds)
> 0: jdbc:phoenix:xxxxxx> 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:xxxxxx> 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.<init>(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:xxxxxx> CREATE INDEX IF NOT EXISTS TEST2 ON TEST.TEST 
> ("testInt", "testCharArray");
> 1 row affected (2.098 seconds)
> 0: jdbc:phoenix:xxxxxx> 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:xxxxxx> 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.<init>(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:xxxxxx> EXPLAIN SELECT /*+ SKIP_SCAN */ "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.447 seconds)
> 0: jdbc:phoenix:xxxxxx> SELECT /*+ SKIP_SCAN */ "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.<init>(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:xxxxxx> SELECT /*+ INDEX(TEST.TEST TEST2) */ "testInt" FROM 
> TEST.TEST;
> +------------------------------------------+
> |                 testInt                  |
> +------------------------------------------+
> | 5                                        |
> +------------------------------------------+
> 1 row selected (0.233 seconds)
> {code}



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

Reply via email to