hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gxch...@apache.org
Subject [2/5] hbase git commit: HBASE-21132 return wrong result in rest multiget
Date Sun, 02 Sep 2018 06:35:50 GMT
HBASE-21132 return wrong result in rest multiget


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/5410b985
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/5410b985
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/5410b985

Branch: refs/heads/branch-2.1
Commit: 5410b9858a39e2b9771cad8140e51766495dd069
Parents: 6e0c627
Author: Guangxu Cheng <guangxucheng@gmail.com>
Authored: Thu Aug 30 20:51:41 2018 +0800
Committer: Guangxu Cheng <guangxucheng@gmail.com>
Committed: Sun Sep 2 14:26:06 2018 +0800

----------------------------------------------------------------------
 .../hadoop/hbase/rest/MultiRowResource.java     |  2 +-
 .../hadoop/hbase/rest/TestMultiRowResource.java | 32 ++++++++++++++++++++
 2 files changed, 33 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/5410b985/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/MultiRowResource.java
----------------------------------------------------------------------
diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/MultiRowResource.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/MultiRowResource.java
index 1b8cdf5..503f8e9 100644
--- a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/MultiRowResource.java
+++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/MultiRowResource.java
@@ -92,7 +92,7 @@ public class MultiRowResource extends ResourceBase implements Constants
{
           ResultGenerator.fromRowSpec(this.tableResource.getName(), rowSpec, null,
             !params.containsKey(NOCACHE_PARAM_NAME));
         Cell value = null;
-        RowModel rowModel = new RowModel(rk);
+        RowModel rowModel = new RowModel(rowSpec.getRow());
         if (generator.hasNext()) {
           while ((value = generator.next()) != null) {
             rowModel.addCell(new CellModel(CellUtil.cloneFamily(value), CellUtil

http://git-wip-us.apache.org/repos/asf/hbase/blob/5410b985/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestMultiRowResource.java
----------------------------------------------------------------------
diff --git a/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestMultiRowResource.java
b/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestMultiRowResource.java
index 928abfd..a8af6c4 100644
--- a/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestMultiRowResource.java
+++ b/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestMultiRowResource.java
@@ -244,5 +244,37 @@ public class TestMultiRowResource {
     client.delete(row_5_url, extraHdr);
   }
 
+  @Test
+  public void testMultiCellGetWithColsInQueryPathJSON() throws IOException, JAXBException
{
+    String row_5_url = "/" + TABLE + "/" + ROW_1 + "/" + COLUMN_1;
+    String row_6_url = "/" + TABLE + "/" + ROW_2 + "/" + COLUMN_2;
+
+    StringBuilder path = new StringBuilder();
+    path.append("/");
+    path.append(TABLE);
+    path.append("/multiget/?row=");
+    path.append(ROW_1);
+    path.append("/");
+    path.append(COLUMN_1);
+    path.append("&row=");
+    path.append(ROW_2);
+    path.append("/");
+    path.append(COLUMN_1);
+
+    client.post(row_5_url, Constants.MIMETYPE_BINARY, Bytes.toBytes(VALUE_1), extraHdr);
+    client.post(row_6_url, Constants.MIMETYPE_BINARY, Bytes.toBytes(VALUE_2), extraHdr);
+
+    Response response = client.get(path.toString(), Constants.MIMETYPE_JSON);
+    assertEquals(200, response.getCode());
+    ObjectMapper mapper = new JacksonJaxbJsonProvider().locateMapper(
+        CellSetModel.class, MediaType.APPLICATION_JSON_TYPE);
+    CellSetModel cellSet = mapper.readValue(response.getBody(), CellSetModel.class);
+    assertEquals(1, cellSet.getRows().size());
+    assertEquals(ROW_1, Bytes.toString(cellSet.getRows().get(0).getKey()));
+    assertEquals(VALUE_1, Bytes.toString(cellSet.getRows().get(0).getCells().get(0).getValue()));
+
+    client.delete(row_5_url, extraHdr);
+    client.delete(row_6_url, extraHdr);
+  }
 }
 


Mime
View raw message