HBASE-10346 Add Documentation for stateless scanner (Vandana Ayyalasomayajula)
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1559266 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4381308ac8
commit
9f949e12e7
|
@ -52,6 +52,7 @@ This package provides a RESTful Web service front end for HBase.
|
|||
<li><a href="#operation_scanner_create">Scanner Creation</a></li>
|
||||
<li><a href="#operation_scanner_next">Scanner Get Next</a></li>
|
||||
<li><a href="#operation_scanner_delete">Scanner Deletion</a></li>
|
||||
<li><a href="#operation_stateless_scanner">Stateless scanner</a></li>
|
||||
</ol>
|
||||
<li><a href="#xmlschema">XML Schema</a></li>
|
||||
<li><a href="#pbufschema">Protobufs Schema</a></li>
|
||||
|
@ -1184,6 +1185,206 @@ Content-Length: 0<br>
|
|||
</blockquote>
|
||||
<p>
|
||||
|
||||
<a name="operation_stateless_scanner">
|
||||
<h3>Stateless Scanner</h3>
|
||||
</a>
|
||||
<pre>
|
||||
GET /<table>/<optional_row_prefix>*?<scan_parameters>
|
||||
</pre>
|
||||
<p align="justify">
|
||||
The current scanner API expects clients to restart scans if there is a REST server failure in the midst. The stateless
|
||||
does not store any state related to scan operation and all the parameters are specified as query parameters.
|
||||
<p>
|
||||
<p>
|
||||
The following are the scan parameters
|
||||
<ol>
|
||||
<li>startrow - The start row for the scan.</li>
|
||||
<li>endrow - The end row for the scan.</li>
|
||||
<li>columns - The columns to scan.</li>
|
||||
<li>starttime, endtime - To only retrieve columns within a specific range of version timestamps,both start and end time must be specified.</li>
|
||||
<li>maxversions - To limit the number of versions of each column to be returned.</li>
|
||||
<li>batchsize - To limit the maximum number of values returned for each call to next().</li>
|
||||
<li>limit - The number of rows to return in the scan operation.</li>
|
||||
</ol>
|
||||
<p>
|
||||
<p>
|
||||
More on start row, end row and limit parameters.
|
||||
<ol>
|
||||
<li>If start row, end row and limit not specified, then the whole table will be scanned.</li>
|
||||
<li>If start row and limit (say N) is specified, then the scan operation will return N rows from the start row specified.</li>
|
||||
<li>If only limit parameter is specified, then the scan operation will return N rows from the start of the table.</li>
|
||||
<li>If limit and end row are specified, then the scan operation will return N rows from start of table till the end row. If the end
|
||||
row is reached before N rows ( say M and M < N ), then M rows will be returned to the user.</li>
|
||||
<li>If start row, end row and limit (say N ) are specified and N < number of rows between start row and end row, then N rows from
|
||||
start row will be returned to the user. If N > (number of rows between start row and end row (say M), then M number of rows
|
||||
will be returned to the user.</li>
|
||||
</ol>
|
||||
<p>
|
||||
<p><b>Examples</b><p>
|
||||
<p>
|
||||
<blockquote>
|
||||
<pre>
|
||||
Lets say we have a table with name "ExampleScanner". On Hbase shell,
|
||||
>> scan 'ExampleScanner'
|
||||
|
||||
ROW COLUMN+CELL
|
||||
testrow1 column=a:1, timestamp=1389900769772, value=testvalue-a1
|
||||
testrow1 column=b:1, timestamp=1389900780536, value=testvalue-b1
|
||||
testrow2 column=a:1, timestamp=1389900823877, value=testvalue-a2
|
||||
testrow2 column=b:1, timestamp=1389900818233, value=testvalue-b2
|
||||
testrow3 column=a:1, timestamp=1389900847336, value=testvalue-a3
|
||||
testrow3 column=b:1, timestamp=1389900856845, value=testvalue-b3
|
||||
</pre>
|
||||
<ul>
|
||||
<li>
|
||||
<pre>
|
||||
<b>Scanning the entire table in json</b>
|
||||
|
||||
curl -H "Accept: application/json" https://localhost:8080/ExampleScanner/*
|
||||
</pre>
|
||||
<p>
|
||||
<tt>
|
||||
{"Row":[{"key":"dGVzdHJvdzE=","Cell":[{"column":"YTox","timestamp":1389900769772,"$":"dGVzdHZhbHVlLWEx"},<br>
|
||||
{"column":"Yjox","timestamp":1389900780536,"$":"dGVzdHZhbHVlLWIx"}]},{"key":"dGVzdHJvdzI=","Cell":[{"column":<br>
|
||||
"YTox","timestamp":1389900823877,"$":"dGVzdHZhbHVlLWEy"}{"column":"Yjox",<br>
|
||||
"timestamp":1389900818233,"$":"dGVzdHZhbHVlLWIy"}]},{"key":"dGVzdHJvdzM=","Cell":[{"column":"YTox",<br>
|
||||
"timestamp":1389900847336,"$":"dGVzdHZhbHVlLWEz"},{"column":"Yjox","timestamp":1389900856845,"$":"dGVzdHZhbHVlLWIz"}]}]}<br>
|
||||
<br>
|
||||
</tt>
|
||||
<p>
|
||||
</li>
|
||||
<li>
|
||||
<pre>
|
||||
<b>Scanning the entire table in XML</b>
|
||||
|
||||
curl -H "Content-Type: text/xml" https://localhost:8080/ExampleScanner/*
|
||||
</pre>
|
||||
<p>
|
||||
<tt>
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><CellSet><Row key="dGVzdHJvdzE="><br>
|
||||
<Cell column="YTox" timestamp="1389900769772">dGVzdHZhbHVlLWEx</Cell><Cell column="Yjox"<br>
|
||||
timestamp="1389900780536">dGVzdHZhbHVlLWIx</Cell></Row><Row key="dGVzdHJvdzI="><<br>
|
||||
Cell column="YTox" timestamp="1389900823877">dGVzdHZhbHVlLWEy</Cell><Cell column="Yjox"<br>
|
||||
timestamp="1389900818233">dGVzdHZhbHVlLWIy</Cell></Row><Row key="dGVzdHJvdzM="><<br>
|
||||
Cell column="YTox" timestamp="1389900847336">dGVzdHZhbHVlLWEz</Cell><Cell column="Yjox"<br>
|
||||
timestamp="1389900856845">dGVzdHZhbHVlLWIz</Cell></Row></CellSet><br>
|
||||
</tt>
|
||||
<p>
|
||||
</li>
|
||||
<li>
|
||||
<pre>
|
||||
<b>Scanning the entire table in binary</b>
|
||||
|
||||
curl -H "Accept: application/protobuf" https://localhost:8080/ExampleScanner/*
|
||||
|
||||
^@Ì
|
||||
B
|
||||
^Htestrow1^R^Z^R^Ca:1^XìÓªä¹("^Ltestvalue-a1^R^Z^R^Cb:1^Xø§«ä¹("^Ltestvalue-b1
|
||||
B
|
||||
^Htestrow2^R^Z^R^Ca:1^XÅúä¹("^Ltestvalue-a2^R^Z^R^Cb:1^X¹Îä¹("^Ltestvalue-b2
|
||||
B
|
||||
^Htestrow3^R^Z^R^Ca:1^X豯ä¹("^Ltestvalue-a3^R^Z^R^Cb:1^X<8d>ü¯ä¹("^Ltestvalue-b3
|
||||
</pre>
|
||||
</li>
|
||||
<li>
|
||||
<pre>
|
||||
<b>Scanning the first row of table</b>
|
||||
|
||||
curl -H "Content-Type: text/xml" https://localhost:8080/ExampleScanner/*?limit=1
|
||||
</pre>
|
||||
<p>
|
||||
<tt>
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><CellSet><Row key="dGVzdHJvdzE="><br>
|
||||
<Cell column="YTox" timestamp="1389900769772">dGVzdHZhbHVlLWEx</Cell><Cell column="Yjox"<br>
|
||||
timestamp="1389900780536">dGVzdHZhbHVlLWIx</Cell></Row></CellSet><br>
|
||||
</tt>
|
||||
<p>
|
||||
</li>
|
||||
<li>
|
||||
<pre>
|
||||
<b>Scanning a given column of table</b>
|
||||
|
||||
curl -H "Content-Type: text/xml" https://localhost:8080/ExampleScanner/*?columns=a:1
|
||||
</pre>
|
||||
<p>
|
||||
<tt>
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><CellSet><Row key="dGVzdHJvdzE="><br>
|
||||
<Cell column="YTox" timestamp="1389900769772">dGVzdHZhbHVlLWEx</Cell></Row><Row key="dGVzdHJvdzI="><<br>
|
||||
Cell column="YTox" timestamp="1389900823877">dGVzdHZhbHVlLWEy</Cell></Row><Row key="dGVzdHJvdzM="><<br>
|
||||
Cell column="YTox" timestamp="1389900847336">dGVzdHZhbHVlLWEz</Cell></Row></CellSet><br>
|
||||
</tt>
|
||||
<p>
|
||||
</li>
|
||||
<li>
|
||||
<pre>
|
||||
<b>Scanning more than one column of table</b>
|
||||
|
||||
curl -H "Content-Type: text/xml" https://localhost:8080/ExampleScanner/*?columns=a:1,b:1
|
||||
</pre>
|
||||
<p>
|
||||
<tt>
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><CellSet><Row key="dGVzdHJvdzE="><<br>
|
||||
Cell column="YTox" timestamp="1389900769772">dGVzdHZhbHVlLWEx</Cell><Cell column="Yjox"<br>
|
||||
timestamp="1389900780536">dGVzdHZhbHVlLWIx</Cell></Row><Row key="dGVzdHJvdzI="><<br>
|
||||
Cell column="YTox" timestamp="1389900823877">dGVzdHZhbHVlLWEy</Cell><Cell column="Yjox"<br>
|
||||
timestamp="1389900818233">dGVzdHZhbHVlLWIy</Cell></Row><Row key="dGVzdHJvdzM="><<br>
|
||||
Cell column="YTox" timestamp="1389900847336">dGVzdHZhbHVlLWEz</Cell><Cell column="Yjox"<br>
|
||||
timestamp="1389900856845">dGVzdHZhbHVlLWIz</Cell></Row></CellSet><br>
|
||||
</tt>
|
||||
<p>
|
||||
</li>
|
||||
<li>
|
||||
<pre>
|
||||
<b>Scanning table with start row and limit</b>
|
||||
|
||||
curl -H "Content-Type: text/xml" https://localhost:8080/ExampleScanner/*?startrow=testrow1&limit=2
|
||||
</pre>
|
||||
<p>
|
||||
<tt>
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><CellSet><Row key="dGVzdHJvdzE="><<br>
|
||||
Cell column="YTox" timestamp="1389900769772">dGVzdHZhbHVlLWEx</Cell><Cell column="Yjox"<br>
|
||||
timestamp="1389900780536">dGVzdHZhbHVlLWIx</Cell></Row><Row key="dGVzdHJvdzI="><<br>
|
||||
Cell column="YTox" timestamp="1389900823877">dGVzdHZhbHVlLWEy</Cell><Cell column="Yjox"<br>
|
||||
timestamp="1389900818233">dGVzdHZhbHVlLWIy</Cell></Row></CellSet><br>
|
||||
</tt>
|
||||
<p>
|
||||
</li>
|
||||
<li>
|
||||
<pre>
|
||||
<b>Scanning with start and end time</b>
|
||||
|
||||
curl -H "Content-Type: text/xml" https://localhost:8080/ExampleScanner/*?starttime=1389900769772&endtime=1389900800000
|
||||
</pre>
|
||||
<p>
|
||||
<tt>
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><CellSet><Row key="dGVzdHJvdzE="><<br>
|
||||
Cell column="YTox" timestamp="1389900769772">dGVzdHZhbHVlLWEx</Cell><Cell column="Yjox"<br>
|
||||
timestamp="1389900780536">dGVzdHZhbHVlLWIx</Cell></Row></CellSet><br>
|
||||
</tt>
|
||||
<p>
|
||||
</li>
|
||||
<li>
|
||||
<pre>
|
||||
<b>Scanning with row prefix</b>
|
||||
|
||||
curl -H "Content-Type: text/xml" https://localhost:8080/ExampleScanner/test*
|
||||
</pre>
|
||||
<p>
|
||||
<tt>
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><CellSet><Row key="dGVzdHJvdzE="><br>
|
||||
<Cell column="YTox" timestamp="1389900769772">dGVzdHZhbHVlLWEx</Cell><Cell column="Yjox"<br>
|
||||
timestamp="1389900780536">dGVzdHZhbHVlLWIx</Cell></Row><Row key="dGVzdHJvdzI="><<br>
|
||||
Cell column="YTox" timestamp="1389900823877">dGVzdHZhbHVlLWEy</Cell><Cell column="Yjox"<br>
|
||||
timestamp="1389900818233">dGVzdHZhbHVlLWIy</Cell></Row><Row key="dGVzdHJvdzM="><<br>
|
||||
Cell column="YTox" timestamp="1389900847336">dGVzdHZhbHVlLWEz</Cell><Cell column="Yjox"<br>
|
||||
timestamp="1389900856845">dGVzdHZhbHVlLWIz</Cell></Row></CellSet><br>
|
||||
</tt>
|
||||
<p>
|
||||
</li>
|
||||
</ul>
|
||||
</blockquote>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<a name="xmlschema">
|
||||
<h2>XML Schema</h2>
|
||||
|
|
Loading…
Reference in New Issue