HBASE-4267 book.xml - data model edits
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1162621 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7aa6268778
commit
4199e1ae02
@ -635,6 +635,61 @@ admin.enableTable(table);
|
||||
specifies a <literal>cell</literal> in HBase.
|
||||
Cell content is uninterrpreted bytes</para>
|
||||
</section>
|
||||
<section xml:id="data_model_operations">
|
||||
<title>Data Model Operations</title>
|
||||
<para>The four primary data model operations are Get, Put, Scan, and Delete. Operations are applied via
|
||||
<link xlink:href="http://hbase.apache.org/docs/current/api/org/apache/hadoop/hbase/client/HTable.html">HTable</link> instances.
|
||||
</para>
|
||||
<section xml:id="get">
|
||||
<title>Get</title>
|
||||
<para><link xlink:href="http://hbase.apache.org/docs/current/api/org/apache/hadoop/hbase/client/Get.html">Get</link> returns
|
||||
attributes for a specified row. Gets are executed via
|
||||
<link xlink:href="http://hbase.apache.org/docs/current/api/org/apache/hadoop/hbase/client/HTable.html#get%28org.apache.hadoop.hbase.client.Get%29">
|
||||
HTable.get</link>.
|
||||
</para>
|
||||
</section>
|
||||
<section xml:id="put">
|
||||
<title>Put</title>
|
||||
<para><link xlink:href="http://hbase.apache.org/docs/current/api/org/apache/hadoop/hbase/client/Put.html">Put</link> either
|
||||
adds new rows to a table (if the key is new) or can update existing rows (if the key already exists). Puts are executed via
|
||||
<link xlink:href="http://hbase.apache.org/docs/current/api/org/apache/hadoop/hbase/client/HTable.html#put%28org.apache.hadoop.hbase.client.Put%29">
|
||||
HTable.put</link> (writeBuffer) or <link xlink:href="http://hbase.apache.org/docs/current/api/org/apache/hadoop/hbase/client/HTable.html#batch%28java.util.List%29">
|
||||
HTable.batch</link> (non-writeBuffer).
|
||||
</para>
|
||||
</section>
|
||||
<section xml:id="scan">
|
||||
<title>Scans</title>
|
||||
<para><link xlink:href="http://hbase.apache.org/docs/current/api/org/apache/hadoop/hbase/client/Scan.html">Scan</link> allow
|
||||
iteration over multiple rows for specified attributes.
|
||||
</para>
|
||||
<para>The following is an example of a
|
||||
on an HTable table instance. Assume that a table is populated with rows with keys "row1", "row2", "row3",
|
||||
and then another set of rows with the keys "abc1", "abc2", and "abc3". The following example shows how startRow and stopRow
|
||||
can be applied to a Scan instance to return the rows beginning with "row".
|
||||
<programlisting>
|
||||
HTable htable = ... // instantiate HTable
|
||||
|
||||
Scan scan = new Scan();
|
||||
scan.addColumn(Bytes.toBytes("cf"),Bytes.toBytes("attr"));
|
||||
scan.setStartRow( Bytes.toBytes("row"));
|
||||
scan.setStopRow( Bytes.toBytes("row" + new byte[] {0})); // note: stop key != start key
|
||||
for(Result result : htable.getScanner(scan)) {
|
||||
// process Result instance
|
||||
}
|
||||
</programlisting>
|
||||
</para>
|
||||
</section>
|
||||
<section xml:id="delete">
|
||||
<title>Delete</title>
|
||||
<para><link xlink:href="http://hbase.apache.org/docs/current/api/org/apache/hadoop/hbase/client/Delete.html">Delete</link> removes
|
||||
a row from a table. Deletes are executed via
|
||||
<link xlink:href="http://hbase.apache.org/docs/current/api/org/apache/hadoop/hbase/client/HTable.html#delete%28org.apache.hadoop.hbase.client.Delete%29">
|
||||
HTable.delete</link>.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
<section xml:id="versions">
|
||||
<title>Versions<indexterm><primary>Versions</primary></indexterm></title>
|
||||
@ -731,7 +786,8 @@ admin.enableTable(table);
|
||||
<programlisting>
|
||||
Get get = new Get(Bytes.toBytes("row1"));
|
||||
Result r = htable.get(get);
|
||||
byte[] b = r.getValue(Bytes.toBytes("cf"), Bytes.toBytes("attr")); // returns current version of value </programlisting>
|
||||
byte[] b = r.getValue(Bytes.toBytes("cf"), Bytes.toBytes("attr")); // returns current version of value
|
||||
</programlisting>
|
||||
</para>
|
||||
</section>
|
||||
<section xml:id="versioned_get_example">
|
||||
@ -781,6 +837,7 @@ admin.enableTable(table);
|
||||
</programlisting>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
</section>
|
||||
|
||||
<section>
|
||||
|
Loading…
x
Reference in New Issue
Block a user