You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "Tareen, Babar" <Ba...@rootmetrics.com> on 2015/09/15 01:24:26 UTC

CheckAndPut like functionality for Phoenix

Hi,

I have implemented HBase's checkAndPut like functionality for Apache Phoenix, based on the comments on PHOENIX-6 (https://issues.apache.org/jira/browse/PHOENIX-6). The Upsert statement is modified to support compare clause, which allows us to pass in an expression. The expression is evaluated against the current record and Upsert is only performed when the expression evaluates to true. This enables conditional updates to the records. I have listed some examples on the github fork here https://github.com/babartareen/phoenix.

I would appreciate your feedback and am hopping that this change could be merged back into the Apache Phoenix project.

Thanks,
Babar

Re: CheckAndPut like functionality for Phoenix

Posted by James Taylor <ja...@apache.org>.
Hi Babar,
Thanks for the work in this area. It's important that we stick with the
SQL-92+ standards, but this seems to deviate from that. Did you know we
have support for transactions over in the txn branch (soon to be merged
into master)? In this optimistic concurrency model, if two different
clients attempt to UPSERT the same row on a transactional table, the last
one to commit would get an exception. Would this solve your use case?

As far as PHOENIX-6, it would be convenient to have a mechanism to not take
an action if a row already exists. Given our planned move to Apache
Calcite, support for ON DUPLICATE KEY IGNORE as specified by that JIRA may
not be the best option. Calcite has support for the MERGE statement which
is even more flexible - that be great if you could add the runtime support
necessary to support that. I've filed PHOENIX-2275 for that.

Thanks,
James


On Sat, Sep 19, 2015 at 8:35 AM, anil gupta <an...@gmail.com> wrote:

> Hi Tareen,
>
> Nice work. It would be nice have this is in Phoenix. Looks promising. I
> also recommend you to comment on JIRA so that its known that you already
> have coded for it.
>
> PS: I m not a committer. So, wont be able to decide on merging this into
> Phoenix.
>
> Thanks,
> Anil Gupta
>
> On Mon, Sep 14, 2015 at 4:24 PM, Tareen, Babar <
> Babar.Tareen@rootmetrics.com
> > wrote:
>
> > Hi,
> >
> > I have implemented HBase's checkAndPut like functionality for Apache
> > Phoenix, based on the comments on PHOENIX-6 (
> > https://issues.apache.org/jira/browse/PHOENIX-6). The Upsert statement
> is
> > modified to support compare clause, which allows us to pass in an
> > expression. The expression is evaluated against the current record and
> > Upsert is only performed when the expression evaluates to true. This
> > enables conditional updates to the records. I have listed some examples
> on
> > the github fork here https://github.com/babartareen/phoenix.
> >
> > I would appreciate your feedback and am hopping that this change could be
> > merged back into the Apache Phoenix project.
> >
> > Thanks,
> > Babar
> >
>
>
>
> --
> Thanks & Regards,
> Anil Gupta
>

Re: CheckAndPut like functionality for Phoenix

Posted by anil gupta <an...@gmail.com>.
Hi Tareen,

Nice work. It would be nice have this is in Phoenix. Looks promising. I
also recommend you to comment on JIRA so that its known that you already
have coded for it.

PS: I m not a committer. So, wont be able to decide on merging this into
Phoenix.

Thanks,
Anil Gupta

On Mon, Sep 14, 2015 at 4:24 PM, Tareen, Babar <Babar.Tareen@rootmetrics.com
> wrote:

> Hi,
>
> I have implemented HBase's checkAndPut like functionality for Apache
> Phoenix, based on the comments on PHOENIX-6 (
> https://issues.apache.org/jira/browse/PHOENIX-6). The Upsert statement is
> modified to support compare clause, which allows us to pass in an
> expression. The expression is evaluated against the current record and
> Upsert is only performed when the expression evaluates to true. This
> enables conditional updates to the records. I have listed some examples on
> the github fork here https://github.com/babartareen/phoenix.
>
> I would appreciate your feedback and am hopping that this change could be
> merged back into the Apache Phoenix project.
>
> Thanks,
> Babar
>



-- 
Thanks & Regards,
Anil Gupta