Yes, this is definitely useful. We have this JIRA for it:
https://issues.apache.org/jira/browse/PHOENIX-6. We'd basically do what
checkAndPut is doing on the back-end and surface it through the ON
DUPLICATE KEY IGNORE syntax (borrowed from MySQL).

Anyone interested in signing up for this? I've already provided a pretty
detailed breakdown of the work required on the above JIRA.

Thanks,
James


On Tue, Apr 15, 2014 at 11:51 PM, Dan Di Spaltro <[email protected]>wrote:

> I have an operation I want to make sure only inserts if there is no row
> there.  Typically in hbase proper I would do a checkAndPut with a null
> value on the column checked.  So technically if that column was empty the
> row would appear to be empty, but under the conditions I have it would be
> fine.  So on to my question is there any way to simulate that with Phoenix
> or do I have to drop down to low-level API to get it done.
>
> I was trying to configure a query similar to this:
>
> create table foo (
>  id varchar not null primary key,
>  attr varchar,
>  change_key varchar
> );
>
> upsert into foo(id, attr, change_key) select '2', 'new', 'blah' from foo
> where id='2' and change_key=NULL;
>
> assuming id '2' doesn't exist this wouldn't insert anything.  Generally I
> have auto-commit set to true.
>
> thoughts? Seems like a useful feature and something natively supported by
> Hbase.
>
> -Dan
>
> --
> Dan Di Spaltro
>

Reply via email to