Hi Kathir

 

Ideally nulls should work with all the ARRAY types.  Do you find any issues in the behavior of these ARRAY data types when you use ‘nulls’?

 

Regards

Ram

 

From: Kathiresan S [mailto:kathiresanselvaraj@gmail.com]
Sent: Wednesday, May 6, 2015 4:59 PM
To: user@phoenix.apache.org
Subject: Re: Phoenix Array Type Null Element

 

What are the other Array base data types (like VARCHAR), that could take null values? 

 

Do the below data types allow NULL as well?

 

BIGINT ARRAY, DOUBLE ARRAY, DATE ARRAY, VARBINARY ARRAY

 

Thanks,

Kathir

 

On Wed, May 6, 2015 at 6:35 AM, Kathiresan S <kathiresanselvaraj@gmail.com> wrote:

Thanks Ram.

 

 

Thanks,

Kathir

 

On Wed, May 6, 2015 at 1:56 AM, Vasudevan, Ramkrishna S <ramkrishna.s.vasudevan@intel.com> wrote:

I raised https://issues.apache.org/jira/browse/PHOENIX-1949 for fixing this.

 

From: Vasudevan, Ramkrishna S [mailto:ramkrishna.s.vasudevan@intel.com]
Sent: Wednesday, May 6, 2015 9:21 AM
To: user@phoenix.apache.org
Subject: RE: Phoenix Array Type Null Element

 

Ideally varchar array should support NULL. This seems to be a bug.  Can you file a JIRA for this?

I can come up with a patch ASAP.

 

Regards

Ram

 

From: Kathiresan S [mailto:kathiresanselvaraj@gmail.com]
Sent: Tuesday, May 5, 2015 10:23 PM
To: user@phoenix.apache.org
Subject: Phoenix Array Type Null Element

 

Hi,

 

Is it possible to insert null elements in an array type column?

 

CREATE TABLE ARRAYTEST124 (ID VARCHAR, NAME VARCHAR ARRAY CONSTRAINT PK PRIMARY KEY(ID))

 

UPSERT INTO ARRAYTEST124 (ID, NAME) VALUES('123',ARRAY['ABC','XYZ',null])

UPSERT INTO ARRAYTEST124 (ID, NAME) VALUES('123',ARRAY['ABC',null,'XYZ'])

UPSERT INTO ARRAYTEST124 (ID, NAME) VALUES('123',ARRAY[null,'ABC','XYZ'])

 

I'm using phoenix 4.4.0-HBase-0.98-rc0

 

I'm getting a null pointer exception, while trying to do the above upserts

 

java.lang.NullPointerException

            at org.apache.phoenix.schema.types.PVarchar.toObject(PVarchar.java:62)

            at org.apache.phoenix.schema.types.PDataType.toObject(PDataType.java:979)

            at org.apache.phoenix.schema.types.PDataType.toObject(PDataType.java:992)

            at org.apache.phoenix.compile.ExpressionCompiler.visitLeave(ExpressionCompiler.java:1275)

            at org.apache.phoenix.compile.ExpressionCompiler.visitLeave(ExpressionCompiler.java:142)

            at org.apache.phoenix.parse.ArrayConstructorNode.accept(ArrayConstructorNode.java:43)

            at org.apache.phoenix.compile.UpsertCompiler.compile(UpsertCompiler.java:733)

            at org.apache.phoenix.jdbc.PhoenixStatement$ExecutableUpsertStatement.compilePlan(PhoenixStatement.java:525)

            at org.apache.phoenix.jdbc.PhoenixStatement$ExecutableUpsertStatement.compilePlan(PhoenixStatement.java:513)

            at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:299)

            at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:292)

            at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)

            at org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:290)

            at org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:222)

            at org.apache.phoenix.jdbc.PhoenixPreparedStatement.execute(PhoenixPreparedStatement.java:173)

            at org.apache.phoenix.jdbc.PhoenixPreparedStatement.execute(PhoenixPreparedStatement.java:178)

 

Thanks,

Kathir