Apache9 commented on code in PR #5870:
URL: https://github.com/apache/hbase/pull/5870#discussion_r1590472140


##########
hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/TableScanResource.java:
##########
@@ -87,12 +85,12 @@ public RowModel next() {
             if ((rs == null) || (count <= 0)) {
               return null;
             }
-            byte[] rowKey = rs.getRow();
-            RowModel rModel = new RowModel(rowKey);
-            List<Cell> kvs = rs.listCells();
-            for (Cell kv : kvs) {
-              rModel.addCell(new CellModel(CellUtil.cloneFamily(kv), 
CellUtil.cloneQualifier(kv),
-                kv.getTimestamp(), CellUtil.cloneValue(kv)));
+            Cell firstCell = rs.rawCells()[0];

Review Comment:
   Here too...



##########
hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/ProtobufStreamingOutput.java:
##########
@@ -91,15 +89,18 @@ private void writeToStream(CellSetModel model, String 
contentType, OutputStream
 
   private CellSetModel createModelFromResults(Result[] results) {
     CellSetModel cellSetModel = new CellSetModel();
-    for (Result rs : results) {
-      byte[] rowKey = rs.getRow();
-      RowModel rModel = new RowModel(rowKey);
-      List<Cell> kvs = rs.listCells();
-      for (Cell kv : kvs) {
-        rModel.addCell(new CellModel(CellUtil.cloneFamily(kv), 
CellUtil.cloneQualifier(kv),
-          kv.getTimestamp(), CellUtil.cloneValue(kv)));
+    for (Result r : results) {
+      if (r.isEmpty()) {
+        continue;
       }
-      cellSetModel.addRow(rModel);
+      Cell firstCell = r.rawCells()[0];

Review Comment:
   Could we extract a common method for this? Seems the code is exactly the 
same with the above code?



##########
hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/model/CellModel.java:
##########
@@ -58,10 +61,11 @@
  * </pre>
  */
 @XmlRootElement(name = "Cell")
-@XmlAccessorType(XmlAccessType.FIELD)
+@XmlAccessorType(XmlAccessType.NONE)

Review Comment:
   Why we need this change?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@hbase.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to