mikewalch opened a new issue #1056: Design API for creating mutations from key/value pairs URL: https://github.com/apache/accumulo/issues/1056 I was writing the following Spark code and realized that it could be simplified if had a better way of going from key/value pairs to Mutations: ```java dataPlus5K.foreachPartition(iter -> { try (AccumuloClient client = Accumulo.newClient().from(props).build(); BatchWriter bw = client.createBatchWriter(outputTable)) { iter.forEachRemaining(kv -> { Key key = kv._1; Value val = kv._2; Mutation m = new Mutation(key.getRow()); m.at().family(key.getColumnFamily()).qualifier(key.getColumnQualifier()) .visibility(key.getColumnVisibility()).timestamp(key.getTimestamp()).put(val); bw.addMutation(m); }); } }); ``` One solution could be a simple function that creates a single mutation from a key/value pair: ```java dataPlus5K.foreachPartition(iter -> { try (AccumuloClient client = Accumulo.newClient().from(props).build(); BatchWriter bw = client.createBatchWriter(outputTable)) { iter.forEachRemaining(kv -> { bw.addMutation(Mutation.from(kv._1, kv_2); }); } }); ``` However, this should be thought out with a design document as it might be better to batch multiple key/value pairs in the same row into a single mutation rather than creating a mutation for every key/value pair.
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services