You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@kudu.apache.org by John Mora <jh...@gmail.com> on 2019/07/16 21:01:04 UTC
Delete or Update by Query
Hi.
I am trying to delete multiple rows at the same time through a condition
using kudu-client.
Let's say:
DELETE FROM table WHERE key>=xx AND key<=yy
However, I could not find its equivalent in kudu-client for java.
I was analyzing delete operations like the one below, but it deletes only
one row at the same time.
Delete delete = table.newDelete();
...
session.apply(delete);
Is there some way to delete multiple rows using a condition?, maybe via a
Scanner or similar.
Thanks in advance for your help.
Cheers,
John Mora
Re: Delete or Update by Query
Posted by John Mora <jh...@gmail.com>.
Hi Adar Lieber-Dembo and Grant Henke,
Thanks for your responses.
I think I will implement your suggestion, using a scanner for selecting the
primary keys and applying a block of multiple individual deletions from the
result.
Thanks,
John Mora
El mar., 16 jul. 2019 a las 16:41, Grant Henke (<gh...@cloudera.com>)
escribió:
> Ultimately you need to use a scanner to get all the rows that match that
> predicate and then delete them.
>
> There is an example of doing this via Spark in the Spark quickstart guide
> here:
>
> https://github.com/apache/kudu/tree/master/examples/quickstart/spark#read-and-modify-data
>
> On Tue, Jul 16, 2019 at 4:17 PM Adar Lieber-Dembo <ad...@cloudera.com>
> wrote:
>
>> Unfortunately there's no way to do that currently: if you want to
>> delete a row, you must provide its complete primary key.
>>
>> On Tue, Jul 16, 2019 at 2:01 PM John Mora <jh...@gmail.com> wrote:
>> >
>> > Hi.
>> >
>> > I am trying to delete multiple rows at the same time through a
>> condition using kudu-client.
>> >
>> > Let's say:
>> > DELETE FROM table WHERE key>=xx AND key<=yy
>> >
>> > However, I could not find its equivalent in kudu-client for java.
>> >
>> > I was analyzing delete operations like the one below, but it deletes
>> only one row at the same time.
>> >
>> > Delete delete = table.newDelete();
>> > ...
>> > session.apply(delete);
>> >
>> > Is there some way to delete multiple rows using a condition?, maybe via
>> a Scanner or similar.
>> >
>> > Thanks in advance for your help.
>> >
>> > Cheers,
>> > John Mora
>>
>
>
> --
> Grant Henke
> Software Engineer | Cloudera
> grant@cloudera.com | twitter.com/gchenke | linkedin.com/in/granthenke
>
Re: Delete or Update by Query
Posted by Grant Henke <gh...@cloudera.com>.
Ultimately you need to use a scanner to get all the rows that match that
predicate and then delete them.
There is an example of doing this via Spark in the Spark quickstart guide
here:
https://github.com/apache/kudu/tree/master/examples/quickstart/spark#read-and-modify-data
On Tue, Jul 16, 2019 at 4:17 PM Adar Lieber-Dembo <ad...@cloudera.com> wrote:
> Unfortunately there's no way to do that currently: if you want to
> delete a row, you must provide its complete primary key.
>
> On Tue, Jul 16, 2019 at 2:01 PM John Mora <jh...@gmail.com> wrote:
> >
> > Hi.
> >
> > I am trying to delete multiple rows at the same time through a condition
> using kudu-client.
> >
> > Let's say:
> > DELETE FROM table WHERE key>=xx AND key<=yy
> >
> > However, I could not find its equivalent in kudu-client for java.
> >
> > I was analyzing delete operations like the one below, but it deletes
> only one row at the same time.
> >
> > Delete delete = table.newDelete();
> > ...
> > session.apply(delete);
> >
> > Is there some way to delete multiple rows using a condition?, maybe via
> a Scanner or similar.
> >
> > Thanks in advance for your help.
> >
> > Cheers,
> > John Mora
>
--
Grant Henke
Software Engineer | Cloudera
grant@cloudera.com | twitter.com/gchenke | linkedin.com/in/granthenke
Re: Delete or Update by Query
Posted by Adar Lieber-Dembo <ad...@cloudera.com>.
Unfortunately there's no way to do that currently: if you want to
delete a row, you must provide its complete primary key.
On Tue, Jul 16, 2019 at 2:01 PM John Mora <jh...@gmail.com> wrote:
>
> Hi.
>
> I am trying to delete multiple rows at the same time through a condition using kudu-client.
>
> Let's say:
> DELETE FROM table WHERE key>=xx AND key<=yy
>
> However, I could not find its equivalent in kudu-client for java.
>
> I was analyzing delete operations like the one below, but it deletes only one row at the same time.
>
> Delete delete = table.newDelete();
> ...
> session.apply(delete);
>
> Is there some way to delete multiple rows using a condition?, maybe via a Scanner or similar.
>
> Thanks in advance for your help.
>
> Cheers,
> John Mora