hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anoopsamj...@apache.org
Subject git commit: HBASE-12084 Remove deprecated APIs from Result.
Date Thu, 25 Sep 2014 02:06:40 GMT
Repository: hbase
Updated Branches:
  refs/heads/master 011bc0441 -> 1b5e6daef


HBASE-12084 Remove deprecated APIs from Result.


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

Branch: refs/heads/master
Commit: 1b5e6daef20550309efaa9b165b0c8d8bb9cb4f8
Parents: 011bc04
Author: anoopsjohn <anoopsamjohn@gmail.com>
Authored: Thu Sep 25 07:36:15 2014 +0530
Committer: anoopsjohn <anoopsamjohn@gmail.com>
Committed: Thu Sep 25 07:36:15 2014 +0530

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/client/Result.java  | 77 --------------------
 .../client/coprocessor/AggregationClient.java   |  4 +-
 .../hbase/master/TableNamespaceManager.java     |  2 +-
 .../hadoop/hbase/client/TestFromClientSide.java | 24 +++---
 .../regionserver/TestScannerWithBulkload.java   | 49 +++++++------
 5 files changed, 40 insertions(+), 116 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/1b5e6dae/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Result.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Result.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Result.java
index 9392490..a041b91 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Result.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Result.java
@@ -107,23 +107,6 @@ public class Result implements CellScannable, CellScanner {
   }
 
   /**
-   * @deprecated Use {@link #create(List)} instead.
-   */
-  @Deprecated
-  public Result(KeyValue [] cells) {
-    this.cells = cells;
-  }
-
-  /**
-   * @deprecated Use {@link #create(List)} instead.
-   */
-  @Deprecated
-  public Result(List<KeyValue> kvs) {
-    // TODO: Here we presume the passed in Cells are KVs.  One day this won't always be so.
-    this(kvs.toArray(new Cell[kvs.size()]), null, false);
-  }
-
-  /**
    * Instantiate a Result with the specified List of KeyValues.
    * <br><strong>Note:</strong> You must ensure that the keyvalues are
already sorted.
    * @param cells List of cells
@@ -203,25 +186,6 @@ public class Result implements CellScannable, CellScanner {
   }
 
   /**
-   * Return an cells of a Result as an array of KeyValues
-   *
-   * WARNING do not use, expensive.  This does an arraycopy of the cell[]'s value.
-   *
-   * Added to ease transition from  0.94 -> 0.96.
-   *
-   * @deprecated as of 0.96, use {@link #rawCells()}
-   * @return array of KeyValues, empty array if nothing in result.
-   */
-  @Deprecated
-  public KeyValue[] raw() {
-    KeyValue[] kvs = new KeyValue[cells.length];
-    for (int i = 0 ; i < kvs.length; i++) {
-      kvs[i] = KeyValueUtil.ensureKeyValue(cells[i]);
-    }
-    return kvs;
-  }
-
-  /**
    * Create a sorted list of the Cell's in this result.
    *
    * Since HBase 0.20.5 this is equivalent to raw().
@@ -233,29 +197,6 @@ public class Result implements CellScannable, CellScanner {
   }
 
   /**
-   * Return an cells of a Result as an array of KeyValues
-   *
-   * WARNING do not use, expensive.  This does  an arraycopy of the cell[]'s value.
-   *
-   * Added to ease transition from  0.94 -> 0.96.
-   *
-   * @deprecated as of 0.96, use {@link #listCells()}
-   * @return all sorted List of KeyValues; can be null if no cells in the result
-   */
-  @Deprecated
-  public List<KeyValue> list() {
-    return isEmpty() ? null : Arrays.asList(raw());
-  }
-
-  /**
-   * @deprecated Use {@link #getColumnCells(byte[], byte[])} instead.
-   */
-  @Deprecated
-  public List<KeyValue> getColumn(byte [] family, byte [] qualifier) {
-    return KeyValueUtil.ensureKeyValues(getColumnCells(family, qualifier));
-  }
-
-  /**
    * Return the Cells for the specific column.  The Cells are sorted in
    * the {@link KeyValue#COMPARATOR} order.  That implies the first entry in
    * the list is the most recent column.  If the query (Scan or Get) only
@@ -358,14 +299,6 @@ public class Result implements CellScannable, CellScanner {
   }
 
   /**
-   * @deprecated Use {@link #getColumnLatestCell(byte[], byte[])} instead.
-   */
-  @Deprecated
-  public KeyValue getColumnLatest(byte [] family, byte [] qualifier) {
-    return KeyValueUtil.ensureKeyValue(getColumnLatestCell(family, qualifier));
-  }
-
-  /**
    * The Cell for the most recent timestamp for a given column.
    *
    * @param family
@@ -390,16 +323,6 @@ public class Result implements CellScannable, CellScanner {
   }
 
   /**
-   * @deprecated Use {@link #getColumnLatestCell(byte[], int, int, byte[], int, int)} instead.
-   */
-  @Deprecated
-  public KeyValue getColumnLatest(byte [] family, int foffset, int flength,
-      byte [] qualifier, int qoffset, int qlength) {
-    return KeyValueUtil.ensureKeyValue(
-        getColumnLatestCell(family, foffset, flength, qualifier, qoffset, qlength));
-  }
-
-  /**
    * The Cell for the most recent timestamp for a given column.
    *
    * @param family family name

http://git-wip-us.apache.org/repos/asf/hbase/blob/1b5e6dae/hbase-client/src/main/java/org/apache/hadoop/hbase/client/coprocessor/AggregationClient.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/coprocessor/AggregationClient.java
b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/coprocessor/AggregationClient.java
index 32ffc3f..ea0e1df 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/coprocessor/AggregationClient.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/coprocessor/AggregationClient.java
@@ -798,7 +798,7 @@ public class AggregationClient {
           for (int i = 0; i < results.length; i++) {
             Result r = results[i];
             // retrieve weight
-            Cell kv = r.getColumnLatest(colFamily, weightQualifier);
+            Cell kv = r.getColumnLatestCell(colFamily, weightQualifier);
             R newValue = ci.getValue(colFamily, weightQualifier, kv);
             S s = ci.castToReturnType(newValue);
             double newSumVal = movingSumVal + ci.divideForAvg(s, 1L);
@@ -807,7 +807,7 @@ public class AggregationClient {
               return value;
             }
             movingSumVal = newSumVal;
-            kv = r.getColumnLatest(colFamily, qualifier);
+            kv = r.getColumnLatestCell(colFamily, qualifier);
             value = ci.getValue(colFamily, qualifier, kv);
             }
           }

http://git-wip-us.apache.org/repos/asf/hbase/blob/1b5e6dae/hbase-server/src/main/java/org/apache/hadoop/hbase/master/TableNamespaceManager.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/TableNamespaceManager.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/TableNamespaceManager.java
index 1bddc01..7132555 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/TableNamespaceManager.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/TableNamespaceManager.java
@@ -276,7 +276,7 @@ public class TableNamespaceManager {
         ResultScanner scanner = nsTable.getScanner(HTableDescriptor.NAMESPACE_FAMILY_INFO_BYTES);
         try {
           for (Result result : scanner) {
-            byte[] val =  CellUtil.cloneValue(result.getColumnLatest(
+            byte[] val =  CellUtil.cloneValue(result.getColumnLatestCell(
                 HTableDescriptor.NAMESPACE_FAMILY_INFO_BYTES,
                 HTableDescriptor.NAMESPACE_COL_DESC_BYTES));
             NamespaceDescriptor ns =

http://git-wip-us.apache.org/repos/asf/hbase/blob/1b5e6dae/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java
index 3bf64c6..e28e944 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java
@@ -4427,8 +4427,8 @@ public class TestFromClientSide {
     assertEquals(0, Bytes.compareTo(Bytes.add(v2,v1), r.getValue(FAMILY, QUALIFIERS[1])));
     // QUALIFIERS[2] previously not exist, verify both value and timestamp are correct
     assertEquals(0, Bytes.compareTo(v2, r.getValue(FAMILY, QUALIFIERS[2])));
-    assertEquals(r.getColumnLatest(FAMILY, QUALIFIERS[0]).getTimestamp(),
-        r.getColumnLatest(FAMILY, QUALIFIERS[2]).getTimestamp());
+    assertEquals(r.getColumnLatestCell(FAMILY, QUALIFIERS[0]).getTimestamp(),
+        r.getColumnLatestCell(FAMILY, QUALIFIERS[2]).getTimestamp());
   }
 
   @Test
@@ -5656,8 +5656,8 @@ public class TestFromClientSide {
     int expectedIndex = 5;
     for (Result result : scanner) {
       assertEquals(result.size(), 1);
-      assertTrue(Bytes.equals(result.raw()[0].getRow(), ROWS[expectedIndex]));
-      assertTrue(Bytes.equals(result.raw()[0].getQualifier(),
+      assertTrue(Bytes.equals(result.rawCells()[0].getRow(), ROWS[expectedIndex]));
+      assertTrue(Bytes.equals(result.rawCells()[0].getQualifier(),
           QUALIFIERS[expectedIndex]));
       expectedIndex--;
     }
@@ -5695,8 +5695,8 @@ public class TestFromClientSide {
     int count = 0;
     for (Result result : ht.getScanner(scan)) {
       assertEquals(result.size(), 1);
-      assertEquals(result.raw()[0].getValueLength(), Bytes.SIZEOF_INT);
-      assertEquals(Bytes.toInt(result.raw()[0].getValue()), VALUE.length);
+      assertEquals(result.rawCells()[0].getValueLength(), Bytes.SIZEOF_INT);
+      assertEquals(Bytes.toInt(result.rawCells()[0].getValue()), VALUE.length);
       count++;
     }
     assertEquals(count, 10);
@@ -5979,15 +5979,15 @@ public class TestFromClientSide {
     result = scanner.next();
     assertTrue("Expected 2 keys but received " + result.size(),
         result.size() == 2);
-    assertTrue(Bytes.equals(result.raw()[0].getRow(), ROWS[4]));
-    assertTrue(Bytes.equals(result.raw()[1].getRow(), ROWS[4]));
-    assertTrue(Bytes.equals(result.raw()[0].getValue(), VALUES[1]));
-    assertTrue(Bytes.equals(result.raw()[1].getValue(), VALUES[2]));
+    assertTrue(Bytes.equals(result.rawCells()[0].getRow(), ROWS[4]));
+    assertTrue(Bytes.equals(result.rawCells()[1].getRow(), ROWS[4]));
+    assertTrue(Bytes.equals(result.rawCells()[0].getValue(), VALUES[1]));
+    assertTrue(Bytes.equals(result.rawCells()[1].getValue(), VALUES[2]));
     result = scanner.next();
     assertTrue("Expected 1 key but received " + result.size(),
         result.size() == 1);
-    assertTrue(Bytes.equals(result.raw()[0].getRow(), ROWS[3]));
-    assertTrue(Bytes.equals(result.raw()[0].getValue(), VALUES[0]));
+    assertTrue(Bytes.equals(result.rawCells()[0].getRow(), ROWS[3]));
+    assertTrue(Bytes.equals(result.rawCells()[0].getValue(), VALUES[0]));
     scanner.close();
     ht.close();
   }

http://git-wip-us.apache.org/repos/asf/hbase/blob/1b5e6dae/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestScannerWithBulkload.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestScannerWithBulkload.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestScannerWithBulkload.java
index d1fda15..1a2fc63 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestScannerWithBulkload.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestScannerWithBulkload.java
@@ -26,6 +26,7 @@ import junit.framework.Assert;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.Cell;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.HTableDescriptor;
@@ -93,13 +94,13 @@ public class TestScannerWithBulkload {
     scanner = table.getScanner(scan);
     result = scanner.next();
     while (result != null) {
-      List<KeyValue> kvs = result.getColumn(Bytes.toBytes("col"), Bytes.toBytes("q"));
-      for (KeyValue _kv : kvs) {
-        if (Bytes.toString(_kv.getRow()).equals("row1")) {
-          System.out.println(Bytes.toString(_kv.getRow()));
-          System.out.println(Bytes.toString(_kv.getQualifier()));
-          System.out.println(Bytes.toString(_kv.getValue()));
-          Assert.assertEquals("version3", Bytes.toString(_kv.getValue()));
+      List<Cell> cells = result.getColumnCells(Bytes.toBytes("col"), Bytes.toBytes("q"));
+      for (Cell _c : cells) {
+        if (Bytes.toString(_c.getRow()).equals("row1")) {
+          System.out.println(Bytes.toString(_c.getRow()));
+          System.out.println(Bytes.toString(_c.getQualifier()));
+          System.out.println(Bytes.toString(_c.getValue()));
+          Assert.assertEquals("version3", Bytes.toString(_c.getValue()));
         }
       }
       result = scanner.next();
@@ -111,13 +112,13 @@ public class TestScannerWithBulkload {
   private Result scanAfterBulkLoad(ResultScanner scanner, Result result, String expctedVal)
       throws IOException {
     while (result != null) {
-      List<KeyValue> kvs = result.getColumn(Bytes.toBytes("col"), Bytes.toBytes("q"));
-      for (KeyValue _kv : kvs) {
-        if (Bytes.toString(_kv.getRow()).equals("row1")) {
-          System.out.println(Bytes.toString(_kv.getRow()));
-          System.out.println(Bytes.toString(_kv.getQualifier()));
-          System.out.println(Bytes.toString(_kv.getValue()));
-          Assert.assertEquals(expctedVal, Bytes.toString(_kv.getValue()));
+      List<Cell> cells = result.getColumnCells(Bytes.toBytes("col"), Bytes.toBytes("q"));
+      for (Cell _c : cells) {
+        if (Bytes.toString(_c.getRow()).equals("row1")) {
+          System.out.println(Bytes.toString(_c.getRow()));
+          System.out.println(Bytes.toString(_c.getQualifier()));
+          System.out.println(Bytes.toString(_c.getValue()));
+          Assert.assertEquals(expctedVal, Bytes.toString(_c.getValue()));
         }
       }
       result = scanner.next();
@@ -188,9 +189,9 @@ public class TestScannerWithBulkload {
 
     ResultScanner scanner = table.getScanner(scan);
     Result result = scanner.next();
-    List<KeyValue> kvs = result.getColumn(Bytes.toBytes("col"), Bytes.toBytes("q"));
-    Assert.assertEquals(1, kvs.size());
-    Assert.assertEquals("version1", Bytes.toString(kvs.get(0).getValue()));
+    List<Cell> cells = result.getColumnCells(Bytes.toBytes("col"), Bytes.toBytes("q"));
+    Assert.assertEquals(1, cells.size());
+    Assert.assertEquals("version1", Bytes.toString(cells.get(0).getValue()));
     scanner.close();
     return table;
   }
@@ -266,13 +267,13 @@ public class TestScannerWithBulkload {
     scanner = table.getScanner(scan);
     result = scanner.next();
     while (result != null) {
-      List<KeyValue> kvs = result.getColumn(Bytes.toBytes("col"), Bytes.toBytes("q"));
-      for (KeyValue _kv : kvs) {
-        if (Bytes.toString(_kv.getRow()).equals("row1")) {
-          System.out.println(Bytes.toString(_kv.getRow()));
-          System.out.println(Bytes.toString(_kv.getQualifier()));
-          System.out.println(Bytes.toString(_kv.getValue()));
-          Assert.assertEquals("version3", Bytes.toString(_kv.getValue()));
+      List<Cell> cells = result.getColumnCells(Bytes.toBytes("col"), Bytes.toBytes("q"));
+      for (Cell _c : cells) {
+        if (Bytes.toString(_c.getRow()).equals("row1")) {
+          System.out.println(Bytes.toString(_c.getRow()));
+          System.out.println(Bytes.toString(_c.getQualifier()));
+          System.out.println(Bytes.toString(_c.getValue()));
+          Assert.assertEquals("version3", Bytes.toString(_c.getValue()));
         }
       }
       result = scanner.next();


Mime
View raw message