Ah, okay. Not what I expected. Thanks for the context. On Tue, Jan 12, 2016 at 12:46 PM, James Taylor <jamestay...@apache.org> wrote:
> Any empty string is treated the same as a null string in Phoenix (just > like in Oracle). See PHOENIX-2422. > > On Tue, Jan 12, 2016 at 12:24 PM, Nick Dimiduk <ndimi...@gmail.com> wrote: > >> Hi there, >> >> I have a question about 0-length VARCHAR columns used in primary keys. >> Specifically, I have a schema like, >> >> > CREATE TABLE test (foo INTEGER NOT NULL, bar VARCHAR NOT NULL, >> CONSTRAINT pk PRIMARY KEY (foo, bar)) SALT_BUCKETS=1; >> >> My understanding is that the compount rowkey for this table is 1-byte >> (salt bucket), 4-bytes (foo), ... (bar). >> >> Inserting a row with '' for bar throws a constraint violation >> >> > UPSERT INTO test VALUES(0, ''); >> Error: ERROR 218 (22018): Constraint violation. TEST.BAR may not be null >> (state=22018,code=218) >> >> In the above statement, TEST.BAR is not null. I expected that Phoenix >> would treat any rowkey content after the first 5 bytes as the value for the >> bar column. Further, I expected that Phoenix could infer any rowkey of >> length 5 as having the value '' for bar because the NOT NULL predicate is >> provided on on the column definition. >> >> Might someone shed some light on the issue at hand? Am I doing something >> dumb? >> >> Thanks, >> Nick >> > >