Author: apurtell
Date: Wed Apr 20 18:48:56 2011
New Revision: 1095482
URL: http://svn.apache.org/viewvc?rev=1095482&view=rev
Log:
HBASE-3798 [REST] Allow representation to elide row key and column key
Modified:
hbase/branches/0.90/CHANGES.txt
hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/rest/RowResource.java
Modified: hbase/branches/0.90/CHANGES.txt
URL:
http://svn.apache.org/viewvc/hbase/branches/0.90/CHANGES.txt?rev=1095482&r1=1095481&r2=1095482&view=diff
==============================================================================
--- hbase/branches/0.90/CHANGES.txt (original)
+++ hbase/branches/0.90/CHANGES.txt Wed Apr 20 18:48:56 2011
@@ -36,6 +36,7 @@ Release 0.90.3 - Unreleased
HBASE-3773 Set ZK max connections much higher in 0.90
HBASE-3767 Improve how HTable handles threads used for multi actions
HBASE-3795 Remove the "Cache hit for row" message
+ HBASE-3798 [REST] Allow representation to elide row key and column key
TASK
HBASE-3748 Add rolling of thrift/rest daemons to graceful_stop.sh script
Modified:
hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/rest/RowResource.java
URL:
http://svn.apache.org/viewvc/hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/rest/RowResource.java?rev=1095482&r1=1095481&r2=1095482&view=diff
==============================================================================
---
hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/rest/RowResource.java
(original)
+++
hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/rest/RowResource.java
Wed Apr 20 18:48:56 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(),