kudu-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Todd Lipcon <t...@cloudera.com>
Subject Re: Delete row by partial key
Date Wed, 15 Feb 2017 18:32:03 GMT
Hi Paul,

You're correct that there is no predicate-based delete currently available,
so you have to scan and then feed the results of the scan back into your
desired mutations/deletes. This is intentional, since right now we don't
have multi-row transactional capabilities, and a "delete by predicate" API
would probably give the false impression that it is transactional.

I also think you're right that there isn't a nice way of propagating a
RowResult into a PartialRow as you need to do here. It seems you're a C++
programmer -- any interest in contributing a patch to make this
transformation a bit easier?

-Todd



On Wed, Feb 15, 2017 at 10:27 AM, Paul Brannan <paul.brannan@thesystech.com>
wrote:

> I want to delete all rows that match a particular partial key.  For
> example, if my schema includes columns "foo", "bar", and "baz" in its
> primary key, I want to be able to delete all rows with "foo=16" and
> "bar=32", regardless of the value of baz.  If I attempt to apply a
> KuduDelete without specifying "baz", I get an error "Illegal state: Key not
> specified".
>
> The best I have come up with so far is to do a scan and copy the data
> cell-by-cell from the RowPtr returned by the scan into the KuduPartialRow
> used by the delete; I don't see any good way in the interface to copy row
> data from one to the other without copying cell-by-cell.  The code looks
> something like:
>
>   for (auto idx : primary_key_column_indexes) {
>     switch(schema.Column(idx).type()) {
>     case KuduColumnSchema::INT16: // GetInt16/SetInt16
>     case KuduColumnSchema::INT32: // GetInt32/SetInt32
>     case KuduColumnSchema::STRING: // GetString/SetString
>     // and so on...
>     }
>   }
>
> Is there a better way?
>
>


-- 
Todd Lipcon
Software Engineer, Cloudera

Mime
View raw message