saintstack commented on a change in pull request #1121: HBASE-20623: 
[WIP]Introduce the helper method "getCellBuilder()" to Mutation
URL: https://github.com/apache/hbase/pull/1121#discussion_r374947794
 
 

 ##########
 File path: src/main/asciidoc/_chapters/datamodel.adoc
 ##########
 @@ -471,6 +471,26 @@ Caution: the version timestamp is used internally by 
HBase for things like time-
 It's usually best to avoid setting this timestamp yourself.
 Prefer using a separate timestamp attribute of the row, or have the timestamp 
as a part of the row key, or both.
 
+===== Cell Version Example
+
+The following Put uses a method getCellBuilder() to get a CellBuilder instance
+that already has relevant Type and Row set.
+
+[source,java]
+----
+
+public static final byte[] CF = "cf".getBytes();
+public static final byte[] ATTR = "attr".getBytes();
+...
+
+Put put = new Put(Bytes.toBytes(row));
+put.add(put.getCellBuilder().setQualifier(ATTR)
+   .setFamily(CF)
+   .setValue(Bytes.toBytes(data))
+   .build());
 
 Review comment:
   Could write this as put.addColumn()? It'd be easier? What you see advantage 
of this being able to do it by Cell? Will it confuse the user?

----------------------------------------------------------------
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

Reply via email to