Reputation: 3024
I am trying to figure out a way to delete a specific row from a table when it has the same row id as another couple rows in Accumulo. This is how I have my table set up:
m0 : property : name -> erp
m0 : property : age -> 23
m0 : purchase : food -> 5.00
m0 : purchase : gas -> 24.00
m0 : purchase : beer -> 15.00
Say I want to delete gas from the table. I know I could use connection.tableOperations().deleteRows(table, start, stop)
but if I pass in the row id of m0 - 1
and m0
to the function it is going to delete all of these entries. Can I do a delete where colFam = something and colQual = something? I didn't see anything in the API to support this but frankenstein code is cool also :)
Upvotes: 1
Views: 335
Reputation: 3024
Yes it is possible. I was thinking of rows and columns still in a sql mindest. In order to delete a column (which is what I was thinking of) rather than a row. You just write another mutation. For example:
Text rowId = new Text("m0");
Text colFam = new Text("purchase");
Text colQual = new Text("gas");
Mutation mut = new Mutation(rowId);
mut.putDelete(colFam, colQual);
writer = connection.createBatchWriter(tableName, new BatchWriter());
try{
writer.addMutation(mut);
}catch{
...
}
Works perfect :)
Upvotes: 2