aboutsummaryrefslogtreecommitdiff
path: root/contrib/storage-hbase/src
diff options
context:
space:
mode:
authorArina Ielchiieva <arina.yelchiyeva@gmail.com>2016-12-20 16:57:15 +0000
committerJinfeng Ni <jni@apache.org>2017-03-01 23:46:19 -0800
commitdcbcb94fd2695edd4bbca63b2759292e99695d47 (patch)
tree7bbfc6493c42caa02a64d5478f65d32932417f8a /contrib/storage-hbase/src
parent79811db5aa8c7f2cdbe6f74c0a40124bea9fb1fd (diff)
DRILL-4963: Fix issues with dynamically loaded overloaded functions
close #701
Diffstat (limited to 'contrib/storage-hbase/src')
-rw-r--r--contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/config/HBasePersistentStore.java16
-rw-r--r--contrib/storage-hbase/src/test/java/org/apache/drill/hbase/TestHBaseTableProvider.java7
2 files changed, 21 insertions, 2 deletions
diff --git a/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/config/HBasePersistentStore.java b/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/config/HBasePersistentStore.java
index 2d329a852..ef6bbfea1 100644
--- a/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/config/HBasePersistentStore.java
+++ b/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/config/HBasePersistentStore.java
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -67,6 +67,20 @@ public class HBasePersistentStore<V> extends BasePersistentStore<V> {
}
@Override
+ public boolean contains(String key) {
+ try {
+ Get get = new Get(row(key));
+ get.addColumn(FAMILY, QUALIFIER);
+ return hbaseTable.exists(get);
+ } catch (IOException e) {
+ throw UserException
+ .dataReadError(e)
+ .message("Caught error while checking row existence '%s' for table '%s'", key, hbaseTableName)
+ .build(logger);
+ }
+ }
+
+ @Override
public V get(String key) {
return get(key, FAMILY);
}
diff --git a/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/TestHBaseTableProvider.java b/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/TestHBaseTableProvider.java
index 6b73283cf..f2783593f 100644
--- a/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/TestHBaseTableProvider.java
+++ b/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/TestHBaseTableProvider.java
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -18,6 +18,8 @@
package org.apache.drill.hbase;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
import java.util.Map.Entry;
@@ -57,6 +59,9 @@ public class TestHBaseTableProvider extends BaseHBaseTest {
assertEquals("v0", hbaseStore.get(""));
assertEquals("testValue", hbaseStore.get(".test"));
+ assertTrue(hbaseStore.contains(""));
+ assertFalse(hbaseStore.contains("unknown_key"));
+
int rowCount = 0;
for (Entry<String, String> entry : Lists.newArrayList(hbaseStore.getAll())) {
rowCount++;