kudu-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Brannan <paul.bran...@thesystech.com>
Subject Delete row by partial key
Date Wed, 15 Feb 2017 18:27:03 GMT
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?

Mime
View raw message