keith-turner commented on code in PR #5702: URL: https://github.com/apache/accumulo/pull/5702#discussion_r2183143639
########## core/src/main/java/org/apache/accumulo/core/data/Mutation.java: ########## @@ -701,6 +701,40 @@ public void put(byte[] columnFamily, byte[] columnQualifier, ColumnVisibility co value); } + /** + * Puts a modification in this mutation given the values contained in the key and the value. All + * appropriate fields of the key are defensively copied. + * + * @param key key containing all key fields + * @param value value + */ + public void put(Key key, Value value) { Review Comment: We probably want to allow the row to differ. Also setting the timestamp from the key is probably not good because inserting two keys w/ the exact same timestamp has undefined behavior at scan and compaction time (so want to avoid code that encourage this practice). Thinking we want something that will only use the colums from a key. To do this, instead of adding this method and the putDelete method could add something like the following to the key builder. ```java public interface FamilyOptions extends QualifierOptions { QualifierOptions family(byte[] colFam); QualifierOptions family(ByteBuffer colFam); QualifierOptions family(CharSequence colFam); QualifierOptions family(Text colFam); // everything above tyhis is existing code in Mutation /** * Uses the columns (family, qualifier, visibility) from the key. All other parts of the key are ignored. */ TimestampOptions columns(Key key); } ``` Then could write code like ```java Key key1 = ... Key key2 = ... Key key3 = ... Mutation m = new Mution(row); //since no timestamp was set, accumulo will set it on the server side to the latest stamp for the tablet m.at().columns(key1).put(someVal); m.at().columns(key2).delete(); m.at().columns(key3).timestamp(someStamp).put(anoterVal); ``` I think this will cover the most common ways we would want to use a key w/ a mutation w/o worrying about row, timestamp, or delete fields from the key. -- 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. To unsubscribe, e-mail: notifications-unsubscr...@accumulo.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org