Thank you James! We appreciate your work on this. I've created https://issues.apache.org/jira/browse/PHOENIX-989 to track the issue.
On Fri, May 16, 2014 at 11:17 PM, James Taylor <[email protected]>wrote: > Hi Jody, > Those are definitely bugs - you should be able to set a column of type > ARRAY to null. Please file a JIRA and we'll get this fixed up. Sorry for > the inconvenience. > Thanks, > James > > > On Fri, May 16, 2014 at 9:16 PM, Jody Landreneau <[email protected] > > wrote: > >> Hello all, >> >> I am using phoenix arrays. My question is in regards as to how you would >> set null for an empty array or for the array field type. I can't seem to >> get that to work. If I have a string[] I can set an array with a single >> empty string, but it seems like I should be able to set the param to null. >> I don't know what I would do for another type of array like bigint. >> >> Example: >> CREATE TABLE regions ( >> region_name VARCHAR NOT NULL, >> nullable_field VARCHAR, >> zips VARCHAR[] >> CONSTRAINT pk PRIMARY KEY (region_name)); >> >> I can >> >> UPSERT INTO regions(region_name, nullable_field) >> VALUES('SF Bay Area', null) >> >> but not >> >> UPSERT INTO regions(region_name, nullable_field, zips) >> VALUES('SF Bay Area', 'one', null) >> >> I can also >> UPSERT INTO regions(region_name, nullable_field, zips) >> VALUES('SF Bay Area', null, ARRAY['']) >> and this seems to return null for the array but not sure how to use this >> approach for other types. >> >> I have the same issue attempting to use jdbc, when I call the >> PreparedStatement's >> *setNull >> <http://docs.oracle.com/javase/7/docs/api/java/sql/PreparedStatement.html#setNull(int,%20int)>*(int >> parameterIndex, >> int sqlType) and I set the sqlType to ARRAY. >> >> Seems that the error I get is >> >> java.lang.NullPointerException >> >> at >> org.apache.phoenix.schema.PDataType$27.isCoercibleTo(PDataType.java:3455) >> >> at >> org.apache.phoenix.compile.UpsertCompiler$3.execute(UpsertCompiler.java:695) >> >> at >> org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:226) >> >> at >> org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:185) >> >> at >> org.apache.phoenix.jdbc.PhoenixPreparedStatement.execute(PhoenixPreparedStatement.java:146) >> >> at >> org.apache.phoenix.jdbc.PhoenixPreparedStatement.execute(PhoenixPreparedStatement.java:151) >> Any thoughts on what I should be seeing or doing? >> >> Thanks in advance -- >> > >
