You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2011/04/20 20:48:52 UTC
svn commit: r1095481 - in /hbase/trunk: CHANGES.txt
src/main/java/org/apache/hadoop/hbase/rest/RowResource.java
Author: apurtell
Date: Wed Apr 20 18:48:51 2011
New Revision: 1095481
URL: http://svn.apache.org/viewvc?rev=1095481&view=rev
Log:
HBASE-3798 [REST] Allow representation to elide row key and column key
Modified:
hbase/trunk/CHANGES.txt
hbase/trunk/src/main/java/org/apache/hadoop/hbase/rest/RowResource.java
Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1095481&r1=1095480&r2=1095481&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Wed Apr 20 18:48:51 2011
@@ -177,6 +177,7 @@ Release 0.91.0 - Unreleased
HBASE-3757 Upgrade to ZK 3.3.3
HBASE-3609 Improve the selection of regions to balance; part 2 (Ted Yu)
HBASE-2939 Allow Client-Side Connection Pooling (Karthik Sankarachary)
+ HBASE-3798 [REST] Allow representation to elide row key and column key
TASKS
HBASE-3559 Move report of split to master OFF the heartbeat channel
Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/rest/RowResource.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/rest/RowResource.java?rev=1095481&r1=1095480&r2=1095481&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/rest/RowResource.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/rest/RowResource.java Wed Apr 20 18:48:51 2011
@@ -162,9 +162,25 @@ public class RowResource extends Resourc
((HTable)table).setAutoFlush(false);
for (RowModel row: rows) {
byte[] key = row.getKey();
+ if (key == null) {
+ key = rowspec.getRow();
+ }
+ if (key == null) {
+ throw new WebApplicationException(Response.Status.BAD_REQUEST);
+ }
Put put = new Put(key);
+ int i = 0;
for (CellModel cell: row.getCells()) {
- byte [][] parts = KeyValue.parseColumn(cell.getColumn());
+ byte[] col = cell.getColumn();
+ if (col == null) try {
+ col = rowspec.getColumns()[i++];
+ } catch (ArrayIndexOutOfBoundsException e) {
+ col = null;
+ }
+ if (col == null) {
+ throw new WebApplicationException(Response.Status.BAD_REQUEST);
+ }
+ byte [][] parts = KeyValue.parseColumn(col);
if (parts.length == 2 && parts[1].length > 0) {
put.add(parts[0], parts[1], cell.getTimestamp(),
tableResource.transform(parts[0], parts[1], cell.getValue(),