hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mberto...@apache.org
Subject [4/5] hbase git commit: HBASE-13779 Calling table.exists() before table.get() end up with an empty Result (addendum)
Date Sat, 30 May 2015 00:42:33 GMT
HBASE-13779 Calling table.exists() before table.get() end up with an empty Result (addendum)


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

Branch: refs/heads/0.98
Commit: 1bde01392f1532a43a010384fe7df37286c20251
Parents: 4c5af52
Author: Matteo Bertozzi <matteo.bertozzi@cloudera.com>
Authored: Fri May 29 17:14:18 2015 -0700
Committer: Matteo Bertozzi <matteo.bertozzi@cloudera.com>
Committed: Fri May 29 17:41:45 2015 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/client/HTable.java  |  2 +-
 .../org/apache/hadoop/hbase/client/TestGet.java | 36 +++++++++++++++++++-
 2 files changed, 36 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/1bde0139/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java
index a6d1d55..744c8e8 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java
@@ -809,7 +809,7 @@ public class HTable implements HTableInterface {
    */
   @Override
   public Result get(final Get get) throws IOException {
-    return get(get, false);
+    return get(get, get.isCheckExistenceOnly());
   }
 
   private Result get(Get get, final boolean checkExistenceOnly) throws IOException {

http://git-wip-us.apache.org/repos/asf/hbase/blob/1bde0139/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestGet.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestGet.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestGet.java
index 1f8ad49..a08ddee 100644
--- a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestGet.java
+++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestGet.java
@@ -41,6 +41,8 @@ import org.apache.hadoop.hbase.filter.FilterList;
 import org.apache.hadoop.hbase.filter.KeyOnlyFilter;
 import org.apache.hadoop.hbase.protobuf.ProtobufUtil;
 import org.apache.hadoop.hbase.protobuf.generated.ClientProtos;
+import org.apache.hadoop.hbase.security.access.Permission;
+import org.apache.hadoop.hbase.security.visibility.Authorizations;
 import org.apache.hadoop.hbase.util.Base64;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.junit.Assert;
@@ -154,12 +156,44 @@ public class TestGet {
     Set<byte[]> qualifiers = get.getFamilyMap().get(family);
     Assert.assertEquals(1, qualifiers.size());
   }
-  
+
   @Test
   public void TestGetRowFromGetCopyConstructor() throws Exception {
     Get get = new Get(ROW);
+    get.setFilter(null);
+    get.setAuthorizations(new Authorizations("foo"));
+    get.setACL("u", new Permission(Permission.Action.READ));
+    get.setIsolationLevel(IsolationLevel.READ_UNCOMMITTED);
+    get.setCheckExistenceOnly(true);
+    get.setClosestRowBefore(true);
+    get.setTimeRange(3, 4);
+    get.setMaxVersions(11);
+    get.setMaxResultsPerColumnFamily(10);
+    get.setRowOffsetPerColumnFamily(11);
+    get.setCacheBlocks(true);
+
     Get copyGet = new Get(get);
     assertEquals(0, Bytes.compareTo(get.getRow(), copyGet.getRow()));
+
+    // from OperationWithAttributes
+    assertEquals(get.getId(), copyGet.getId());
+
+    // from Query class
+    assertEquals(get.getFilter(), copyGet.getFilter());
+    assertTrue(get.getAuthorizations().toString().equals(copyGet.getAuthorizations().toString()));
+    assertTrue(Bytes.equals(get.getACL(), copyGet.getACL()));
+    assertEquals(get.getIsolationLevel(), copyGet.getIsolationLevel());
+
+    // from Get class
+    assertEquals(get.isCheckExistenceOnly(), copyGet.isCheckExistenceOnly());
+    assertEquals(get.isClosestRowBefore(), copyGet.isClosestRowBefore());
+    assertTrue(get.getTimeRange().equals(copyGet.getTimeRange()));
+    assertEquals(get.isClosestRowBefore(), copyGet.isClosestRowBefore());
+    assertEquals(get.getMaxVersions(), copyGet.getMaxVersions());
+    assertEquals(get.getMaxResultsPerColumnFamily(), copyGet.getMaxResultsPerColumnFamily());
+    assertEquals(get.getRowOffsetPerColumnFamily(), copyGet.getRowOffsetPerColumnFamily());
+    assertEquals(get.getCacheBlocks(), copyGet.getCacheBlocks());
+    assertEquals(get.getId(), copyGet.getId());
   }
 
   @Test


Mime
View raw message