You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by al...@apache.org on 2019/01/09 07:38:48 UTC
[4/4] hbase git commit: HBASE-21661 Provide Thrift2 implementation of
Table/Admin
HBASE-21661 Provide Thrift2 implementation of Table/Admin
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/f053003c
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/f053003c
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/f053003c
Branch: refs/heads/master
Commit: f053003ce7e8d9c86b2ff762b646d69e5e04cfe2
Parents: 5c902b4
Author: Allan Yang <al...@apache.org>
Authored: Wed Jan 9 15:38:23 2019 +0800
Committer: Allan Yang <al...@apache.org>
Committed: Wed Jan 9 15:38:23 2019 +0800
----------------------------------------------------------------------
.../apache/hadoop/hbase/thrift/Constants.java | 8 +
.../hadoop/hbase/thrift/ThriftServer.java | 11 +
.../hbase/thrift/generated/AlreadyExists.java | 2 +-
.../hbase/thrift/generated/BatchMutation.java | 2 +-
.../thrift/generated/ColumnDescriptor.java | 2 +-
.../hadoop/hbase/thrift/generated/Hbase.java | 2 +-
.../hadoop/hbase/thrift/generated/IOError.java | 2 +-
.../hbase/thrift/generated/IllegalArgument.java | 2 +-
.../hadoop/hbase/thrift/generated/Mutation.java | 2 +-
.../hadoop/hbase/thrift/generated/TAppend.java | 2 +-
.../hadoop/hbase/thrift/generated/TCell.java | 2 +-
.../hadoop/hbase/thrift/generated/TColumn.java | 2 +-
.../hbase/thrift/generated/TIncrement.java | 2 +-
.../hbase/thrift/generated/TRegionInfo.java | 2 +-
.../hbase/thrift/generated/TRowResult.java | 2 +-
.../hadoop/hbase/thrift/generated/TScan.java | 2 +-
.../thrift2/ThriftHBaseServiceHandler.java | 4 +-
.../hadoop/hbase/thrift2/ThriftUtilities.java | 437 ++++++
.../hbase/thrift2/client/ThriftAdmin.java | 1405 ++++++++++++++++++
.../thrift2/client/ThriftClientBuilder.java | 37 +
.../hbase/thrift2/client/ThriftConnection.java | 322 ++++
.../hbase/thrift2/client/ThriftTable.java | 492 ++++++
.../hadoop/hbase/thrift2/generated/TAppend.java | 2 +-
.../hbase/thrift2/generated/TAuthorization.java | 2 +-
.../thrift2/generated/TCellVisibility.java | 2 +-
.../hadoop/hbase/thrift2/generated/TColumn.java | 2 +-
.../generated/TColumnFamilyDescriptor.java | 2 +-
.../thrift2/generated/TColumnIncrement.java | 2 +-
.../hbase/thrift2/generated/TColumnValue.java | 2 +-
.../hadoop/hbase/thrift2/generated/TDelete.java | 2 +-
.../hadoop/hbase/thrift2/generated/TGet.java | 127 +-
.../hbase/thrift2/generated/THBaseService.java | 122 +-
.../hbase/thrift2/generated/THRegionInfo.java | 2 +-
.../thrift2/generated/THRegionLocation.java | 2 +-
.../hbase/thrift2/generated/TIOError.java | 2 +-
.../thrift2/generated/TIllegalArgument.java | 2 +-
.../hbase/thrift2/generated/TIncrement.java | 2 +-
.../thrift2/generated/TNamespaceDescriptor.java | 2 +-
.../hadoop/hbase/thrift2/generated/TPut.java | 2 +-
.../hadoop/hbase/thrift2/generated/TResult.java | 2 +-
.../hbase/thrift2/generated/TRowMutations.java | 2 +-
.../hadoop/hbase/thrift2/generated/TScan.java | 127 +-
.../hbase/thrift2/generated/TServerName.java | 2 +-
.../thrift2/generated/TTableDescriptor.java | 2 +-
.../hbase/thrift2/generated/TTableName.java | 50 +-
.../hbase/thrift2/generated/TTimeRange.java | 2 +-
.../apache/hadoop/hbase/thrift2/hbase.thrift | 13 +-
.../hbase/thrift2/TestThriftConnection.java | 841 +++++++++++
48 files changed, 3946 insertions(+), 118 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/f053003c/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/Constants.java
----------------------------------------------------------------------
diff --git a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/Constants.java b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/Constants.java
index 8e3d004..55f2499 100644
--- a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/Constants.java
+++ b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/Constants.java
@@ -144,8 +144,16 @@ public final class Constants {
public static final String THRIFT_READONLY_ENABLED = "hbase.thrift.readonly";
public static final boolean THRIFT_READONLY_ENABLED_DEFAULT = false;
+ public static final String HBASE_THRIFT_CLIENT_SCANNER_CACHING =
+ "hbase.thrift.client.scanner.caching";
+ public static final int HBASE_THRIFT_CLIENT_SCANNER_CACHING_DEFAULT = 20;
+ public static final String HBASE_THRIFT_SERVER_NAME = "hbase.thrift.server.name";
+ public static final String HBASE_THRIFT_SERVER_PORT = "hbase.thrift.server.port";
+
+ public static final String HBASE_THRIFT_CLIENT_BUIDLER_CLASS =
+ "hbase.thrift.client.builder.class";
}
http://git-wip-us.apache.org/repos/asf/hbase/blob/f053003c/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServer.java
----------------------------------------------------------------------
diff --git a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServer.java b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServer.java
index 6d11ac6..830ce52 100644
--- a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServer.java
+++ b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServer.java
@@ -141,6 +141,7 @@ import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.apache.hbase.thirdparty.com.google.common.annotations.VisibleForTesting;
import org.apache.hbase.thirdparty.com.google.common.base.Joiner;
import org.apache.hbase.thirdparty.com.google.common.base.Splitter;
import org.apache.hbase.thirdparty.com.google.common.util.concurrent.ThreadFactoryBuilder;
@@ -277,6 +278,16 @@ public class ThriftServer extends Configured implements Tool {
HbaseHandlerMetricsProxy.newInstance((Hbase.Iface) hbaseServiceHandler, metrics, conf));
}
+ @VisibleForTesting
+ public TServer getTserver() {
+ return tserver;
+ }
+
+ @VisibleForTesting
+ public Server getHttpServer() {
+ return httpServer;
+ }
+
protected void printUsageAndExit(Options options, int exitCode)
throws ExitCodeException {
HelpFormatter formatter = new HelpFormatter();
http://git-wip-us.apache.org/repos/asf/hbase/blob/f053003c/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/AlreadyExists.java
----------------------------------------------------------------------
diff --git a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/AlreadyExists.java b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/AlreadyExists.java
index 4457b9f..117165e 100644
--- a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/AlreadyExists.java
+++ b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/AlreadyExists.java
@@ -38,7 +38,7 @@ import org.slf4j.LoggerFactory;
* An AlreadyExists exceptions signals that a table with the specified
* name already exists
*/
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2018-12-28")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2019-01-03")
public class AlreadyExists extends TException implements org.apache.thrift.TBase<AlreadyExists, AlreadyExists._Fields>, java.io.Serializable, Cloneable, Comparable<AlreadyExists> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("AlreadyExists");
http://git-wip-us.apache.org/repos/asf/hbase/blob/f053003c/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/BatchMutation.java
----------------------------------------------------------------------
diff --git a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/BatchMutation.java b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/BatchMutation.java
index f605286..27e3550 100644
--- a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/BatchMutation.java
+++ b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/BatchMutation.java
@@ -37,7 +37,7 @@ import org.slf4j.LoggerFactory;
/**
* A BatchMutation object is used to apply a number of Mutations to a single row.
*/
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2018-12-28")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2019-01-03")
public class BatchMutation implements org.apache.thrift.TBase<BatchMutation, BatchMutation._Fields>, java.io.Serializable, Cloneable, Comparable<BatchMutation> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("BatchMutation");
http://git-wip-us.apache.org/repos/asf/hbase/blob/f053003c/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/ColumnDescriptor.java
----------------------------------------------------------------------
diff --git a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/ColumnDescriptor.java b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/ColumnDescriptor.java
index c0e885d..36b7e4f 100644
--- a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/ColumnDescriptor.java
+++ b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/ColumnDescriptor.java
@@ -39,7 +39,7 @@ import org.slf4j.LoggerFactory;
* such as the number of versions, compression settings, etc. It is
* used as input when creating a table or adding a column.
*/
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2018-12-28")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2019-01-03")
public class ColumnDescriptor implements org.apache.thrift.TBase<ColumnDescriptor, ColumnDescriptor._Fields>, java.io.Serializable, Cloneable, Comparable<ColumnDescriptor> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ColumnDescriptor");
http://git-wip-us.apache.org/repos/asf/hbase/blob/f053003c/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/Hbase.java
----------------------------------------------------------------------
diff --git a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/Hbase.java b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/Hbase.java
index 54bb4ce..3870711 100644
--- a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/Hbase.java
+++ b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/Hbase.java
@@ -34,7 +34,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2018-12-28")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2019-01-03")
public class Hbase {
public interface Iface {
http://git-wip-us.apache.org/repos/asf/hbase/blob/f053003c/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/IOError.java
----------------------------------------------------------------------
diff --git a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/IOError.java b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/IOError.java
index 09d076c..13f7b4e 100644
--- a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/IOError.java
+++ b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/IOError.java
@@ -39,7 +39,7 @@ import org.slf4j.LoggerFactory;
* to the Hbase master or an Hbase region server. Also used to return
* more general Hbase error conditions.
*/
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2018-12-28")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2019-01-03")
public class IOError extends TException implements org.apache.thrift.TBase<IOError, IOError._Fields>, java.io.Serializable, Cloneable, Comparable<IOError> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("IOError");
http://git-wip-us.apache.org/repos/asf/hbase/blob/f053003c/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/IllegalArgument.java
----------------------------------------------------------------------
diff --git a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/IllegalArgument.java b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/IllegalArgument.java
index bfe4380..df9fe41 100644
--- a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/IllegalArgument.java
+++ b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/IllegalArgument.java
@@ -38,7 +38,7 @@ import org.slf4j.LoggerFactory;
* An IllegalArgument exception indicates an illegal or invalid
* argument was passed into a procedure.
*/
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2018-12-28")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2019-01-03")
public class IllegalArgument extends TException implements org.apache.thrift.TBase<IllegalArgument, IllegalArgument._Fields>, java.io.Serializable, Cloneable, Comparable<IllegalArgument> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("IllegalArgument");
http://git-wip-us.apache.org/repos/asf/hbase/blob/f053003c/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/Mutation.java
----------------------------------------------------------------------
diff --git a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/Mutation.java b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/Mutation.java
index 967e3d1..7c9c439 100644
--- a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/Mutation.java
+++ b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/Mutation.java
@@ -37,7 +37,7 @@ import org.slf4j.LoggerFactory;
/**
* A Mutation object is used to either update or delete a column-value.
*/
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2018-12-28")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2019-01-03")
public class Mutation implements org.apache.thrift.TBase<Mutation, Mutation._Fields>, java.io.Serializable, Cloneable, Comparable<Mutation> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Mutation");
http://git-wip-us.apache.org/repos/asf/hbase/blob/f053003c/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/TAppend.java
----------------------------------------------------------------------
diff --git a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/TAppend.java b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/TAppend.java
index 599f645..46c0fa0 100644
--- a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/TAppend.java
+++ b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/TAppend.java
@@ -37,7 +37,7 @@ import org.slf4j.LoggerFactory;
/**
* An Append object is used to specify the parameters for performing the append operation.
*/
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2018-12-28")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2019-01-03")
public class TAppend implements org.apache.thrift.TBase<TAppend, TAppend._Fields>, java.io.Serializable, Cloneable, Comparable<TAppend> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAppend");
http://git-wip-us.apache.org/repos/asf/hbase/blob/f053003c/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/TCell.java
----------------------------------------------------------------------
diff --git a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/TCell.java b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/TCell.java
index c8f3576..db31d9e 100644
--- a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/TCell.java
+++ b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/TCell.java
@@ -40,7 +40,7 @@ import org.slf4j.LoggerFactory;
* the timestamp of a cell to a first-class value, making it easy to take
* note of temporal data. Cell is used all the way from HStore up to HTable.
*/
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2018-12-28")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2019-01-03")
public class TCell implements org.apache.thrift.TBase<TCell, TCell._Fields>, java.io.Serializable, Cloneable, Comparable<TCell> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TCell");
http://git-wip-us.apache.org/repos/asf/hbase/blob/f053003c/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/TColumn.java
----------------------------------------------------------------------
diff --git a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/TColumn.java b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/TColumn.java
index 0ce1d75..1f7d341 100644
--- a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/TColumn.java
+++ b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/TColumn.java
@@ -37,7 +37,7 @@ import org.slf4j.LoggerFactory;
/**
* Holds column name and the cell.
*/
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2018-12-28")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2019-01-03")
public class TColumn implements org.apache.thrift.TBase<TColumn, TColumn._Fields>, java.io.Serializable, Cloneable, Comparable<TColumn> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TColumn");
http://git-wip-us.apache.org/repos/asf/hbase/blob/f053003c/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/TIncrement.java
----------------------------------------------------------------------
diff --git a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/TIncrement.java b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/TIncrement.java
index 6c0827b..12dbe73 100644
--- a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/TIncrement.java
+++ b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/TIncrement.java
@@ -38,7 +38,7 @@ import org.slf4j.LoggerFactory;
* For increments that are not incrementColumnValue
* equivalents.
*/
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2018-12-28")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2019-01-03")
public class TIncrement implements org.apache.thrift.TBase<TIncrement, TIncrement._Fields>, java.io.Serializable, Cloneable, Comparable<TIncrement> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TIncrement");
http://git-wip-us.apache.org/repos/asf/hbase/blob/f053003c/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/TRegionInfo.java
----------------------------------------------------------------------
diff --git a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/TRegionInfo.java b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/TRegionInfo.java
index d2d3e0e..3870cae 100644
--- a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/TRegionInfo.java
+++ b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/TRegionInfo.java
@@ -37,7 +37,7 @@ import org.slf4j.LoggerFactory;
/**
* A TRegionInfo contains information about an HTable region.
*/
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2018-12-28")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2019-01-03")
public class TRegionInfo implements org.apache.thrift.TBase<TRegionInfo, TRegionInfo._Fields>, java.io.Serializable, Cloneable, Comparable<TRegionInfo> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TRegionInfo");
http://git-wip-us.apache.org/repos/asf/hbase/blob/f053003c/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/TRowResult.java
----------------------------------------------------------------------
diff --git a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/TRowResult.java b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/TRowResult.java
index 6520007..da65687 100644
--- a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/TRowResult.java
+++ b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/TRowResult.java
@@ -37,7 +37,7 @@ import org.slf4j.LoggerFactory;
/**
* Holds row name and then a map of columns to cells.
*/
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2018-12-28")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2019-01-03")
public class TRowResult implements org.apache.thrift.TBase<TRowResult, TRowResult._Fields>, java.io.Serializable, Cloneable, Comparable<TRowResult> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TRowResult");
http://git-wip-us.apache.org/repos/asf/hbase/blob/f053003c/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/TScan.java
----------------------------------------------------------------------
diff --git a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/TScan.java b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/TScan.java
index fcc237d..0aabf0b 100644
--- a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/TScan.java
+++ b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/TScan.java
@@ -37,7 +37,7 @@ import org.slf4j.LoggerFactory;
/**
* A Scan object is used to specify scanner parameters when opening a scanner.
*/
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2018-12-28")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2019-01-03")
public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, java.io.Serializable, Cloneable, Comparable<TScan> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TScan");
http://git-wip-us.apache.org/repos/asf/hbase/blob/f053003c/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftHBaseServiceHandler.java
----------------------------------------------------------------------
diff --git a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftHBaseServiceHandler.java b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftHBaseServiceHandler.java
index a9ec646..519a16b 100644
--- a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftHBaseServiceHandler.java
+++ b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftHBaseServiceHandler.java
@@ -575,7 +575,7 @@ public class ThriftHBaseServiceHandler extends HBaseServiceHandler implements TH
public List<TTableDescriptor> getTableDescriptorsByPattern(String regex, boolean includeSysTables)
throws TIOError, TException {
try {
- Pattern pattern = Pattern.compile(regex);
+ Pattern pattern = (regex == null ? null : Pattern.compile(regex));
List<TableDescriptor> tableDescriptors = connectionCache.getAdmin()
.listTableDescriptors(pattern, includeSysTables);
return tableDescriptorsFromHBase(tableDescriptors);
@@ -600,7 +600,7 @@ public class ThriftHBaseServiceHandler extends HBaseServiceHandler implements TH
public List<TTableName> getTableNamesByPattern(String regex, boolean includeSysTables)
throws TIOError, TException {
try {
- Pattern pattern = Pattern.compile(regex);
+ Pattern pattern = (regex == null ? null : Pattern.compile(regex));
TableName[] tableNames = connectionCache.getAdmin()
.listTableNames(pattern, includeSysTables);
return tableNamesFromHBase(tableNames);
http://git-wip-us.apache.org/repos/asf/hbase/blob/f053003c/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftUtilities.java
----------------------------------------------------------------------
diff --git a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftUtilities.java b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftUtilities.java
index 63c7007..3496726 100644
--- a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftUtilities.java
+++ b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftUtilities.java
@@ -25,15 +25,19 @@ import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import java.util.NavigableSet;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellBuilderFactory;
import org.apache.hadoop.hbase.CellBuilderType;
import org.apache.hadoop.hbase.CellUtil;
import org.apache.hadoop.hbase.CompareOperator;
+import org.apache.hadoop.hbase.ExtendedCellBuilder;
+import org.apache.hadoop.hbase.ExtendedCellBuilderFactory;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.HRegionLocation;
+import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.KeepDeletedCells;
import org.apache.hadoop.hbase.NamespaceDescriptor;
import org.apache.hadoop.hbase.PrivateCellUtil;
@@ -47,6 +51,7 @@ import org.apache.hadoop.hbase.client.Delete;
import org.apache.hadoop.hbase.client.Durability;
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.Increment;
+import org.apache.hadoop.hbase.client.Mutation;
import org.apache.hadoop.hbase.client.OperationWithAttributes;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.Result;
@@ -55,14 +60,20 @@ import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.client.Scan.ReadType;
import org.apache.hadoop.hbase.client.TableDescriptor;
import org.apache.hadoop.hbase.client.TableDescriptorBuilder;
+import org.apache.hadoop.hbase.exceptions.DeserializationException;
+import org.apache.hadoop.hbase.filter.Filter;
+import org.apache.hadoop.hbase.filter.FilterBase;
import org.apache.hadoop.hbase.filter.ParseFilter;
+import org.apache.hadoop.hbase.io.TimeRange;
import org.apache.hadoop.hbase.io.compress.Compression;
import org.apache.hadoop.hbase.io.encoding.DataBlockEncoding;
import org.apache.hadoop.hbase.regionserver.BloomType;
import org.apache.hadoop.hbase.security.visibility.Authorizations;
import org.apache.hadoop.hbase.security.visibility.CellVisibility;
import org.apache.hadoop.hbase.thrift2.generated.TAppend;
+import org.apache.hadoop.hbase.thrift2.generated.TAuthorization;
import org.apache.hadoop.hbase.thrift2.generated.TBloomFilterType;
+import org.apache.hadoop.hbase.thrift2.generated.TCellVisibility;
import org.apache.hadoop.hbase.thrift2.generated.TColumn;
import org.apache.hadoop.hbase.thrift2.generated.TColumnFamilyDescriptor;
import org.apache.hadoop.hbase.thrift2.generated.TColumnIncrement;
@@ -179,6 +190,14 @@ public final class ThriftUtilities {
out.addFamily(column.getFamily());
}
}
+ if (in.isSetFilterBytes()) {
+ try {
+ Filter filter = FilterBase.parseFrom(in.getFilterBytes());
+ out.setFilter(filter);
+ } catch (DeserializationException e) {
+ throw new RuntimeException(e);
+ }
+ }
return out;
}
@@ -579,6 +598,80 @@ public final class ThriftUtilities {
out.setReplicaId(in.getTargetReplicaId());
}
+ if (in.isSetFilterBytes()) {
+ try {
+ Filter filter = FilterBase.parseFrom(in.getFilterBytes());
+ out.setFilter(filter);
+ } catch (DeserializationException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ return out;
+ }
+
+ public static TScan scanFromHBase(Scan in) throws IOException {
+ TScan out = new TScan();
+ out.setStartRow(in.getStartRow());
+ out.setStopRow(in.getStopRow());
+ out.setCaching(in.getCaching());
+ out.setMaxVersions(in.getMaxVersions());
+ for (Map.Entry<byte[], NavigableSet<byte[]>> family : in.getFamilyMap().entrySet()) {
+
+ if (family.getValue() != null && !family.getValue().isEmpty()) {
+ for (byte[] qualifier : family.getValue()) {
+ TColumn column = new TColumn();
+ column.setFamily(family.getKey());
+ column.setQualifier(qualifier);
+ out.addToColumns(column);
+ }
+ } else {
+ TColumn column = new TColumn();
+ column.setFamily(family.getKey());
+ out.addToColumns(column);
+ }
+ }
+ TTimeRange tTimeRange = new TTimeRange();
+ tTimeRange.setMinStamp(in.getTimeRange().getMin()).setMaxStamp(in.getTimeRange().getMax());
+ out.setTimeRange(tTimeRange);
+ out.setBatchSize(in.getBatch());
+
+ for (Map.Entry<String, byte[]> attribute : in.getAttributesMap().entrySet()) {
+ out.putToAttributes(ByteBuffer.wrap(Bytes.toBytes(attribute.getKey())),
+ ByteBuffer.wrap(attribute.getValue()));
+ }
+
+ try {
+ Authorizations authorizations = in.getAuthorizations();
+ if (authorizations != null) {
+ TAuthorization tAuthorization = new TAuthorization();
+ tAuthorization.setLabels(authorizations.getLabels());
+ out.setAuthorizations(tAuthorization);
+ }
+ } catch (DeserializationException e) {
+ throw new RuntimeException(e);
+ }
+
+ out.setReversed(in.isReversed());
+ out.setCacheBlocks(in.getCacheBlocks());
+ out.setReadType(readTypeFromHBase(in.getReadType()));
+ out.setLimit(in.getLimit());
+ out.setConsistency(consistencyFromHBase(in.getConsistency()));
+ out.setTargetReplicaId(in.getReplicaId());
+ for (Map.Entry<byte[], TimeRange> entry : in.getColumnFamilyTimeRange().entrySet()) {
+ if (entry.getValue() != null) {
+ TTimeRange timeRange = new TTimeRange();
+ timeRange.setMinStamp(entry.getValue().getMin()).setMaxStamp(entry.getValue().getMax());
+ out.putToColFamTimeRangeMap(ByteBuffer.wrap(entry.getKey()), timeRange);
+ }
+ }
+ if (in.getFilter() != null) {
+ try {
+ out.setFilterBytes(in.getFilter().toByteArray());
+ } catch (IOException ioE) {
+ throw new RuntimeException(ioE);
+ }
+ }
return out;
}
@@ -713,6 +806,15 @@ public final class ThriftUtilities {
}
}
+ private static TReadType readTypeFromHBase(ReadType readType) {
+ switch (readType) {
+ case DEFAULT: return TReadType.DEFAULT;
+ case STREAM: return TReadType.STREAM;
+ case PREAD: return TReadType.PREAD;
+ default: return TReadType.DEFAULT;
+ }
+ }
+
private static Consistency consistencyFromThrift(TConsistency tConsistency) {
switch (tConsistency.getValue()) {
case 1: return Consistency.STRONG;
@@ -725,6 +827,15 @@ public final class ThriftUtilities {
return TableName.valueOf(tableName.getNs(), tableName.getQualifier());
}
+ public static TableName[] tableNamesArrayFromThrift(List<TTableName> tableNames) {
+ TableName[] out = new TableName[tableNames.size()];
+ int index = 0;
+ for (TTableName tableName : tableNames) {
+ out[index++] = tableNameFromThrift(tableName);
+ }
+ return out;
+ }
+
public static List<TableName> tableNamesFromThrift(List<TTableName> tableNames) {
List<TableName> out = new ArrayList<>(tableNames.size());
for (TTableName tableName : tableNames) {
@@ -740,6 +851,14 @@ public final class ThriftUtilities {
return tableName;
}
+ public static List<TTableName> tableNamesFromHBase(List<TableName> in) {
+ List<TTableName> out = new ArrayList<>(in.size());
+ for (TableName tableName : in) {
+ out.add(tableNameFromHBase(tableName));
+ }
+ return out;
+ }
+
public static List<TTableName> tableNamesFromHBase(TableName[] in) {
List<TTableName> out = new ArrayList<>(in.length);
for (TableName tableName : in) {
@@ -920,6 +1039,28 @@ public final class ThriftUtilities {
return builder.build();
}
+ public static HTableDescriptor hTableDescriptorFromThrift(TTableDescriptor in) {
+ return new HTableDescriptor(tableDescriptorFromThrift(in));
+ }
+
+ public static HTableDescriptor[] hTableDescriptorsFromThrift(List<TTableDescriptor> in) {
+ HTableDescriptor[] out = new HTableDescriptor[in.size()];
+ int index = 0;
+ for (TTableDescriptor tTableDescriptor : in) {
+ out[index++] = hTableDescriptorFromThrift(tTableDescriptor);
+ }
+ return out;
+ }
+
+
+ public static List<TableDescriptor> tableDescriptorsFromThrift(List<TTableDescriptor> in) {
+ List<TableDescriptor> out = new ArrayList<>();
+ for (TTableDescriptor tableDescriptor : in) {
+ out.add(tableDescriptorFromThrift(tableDescriptor));
+ }
+ return out;
+ }
+
private static TDurability durabilityFromHBase(Durability durability) {
switch (durability) {
case USE_DEFAULT: return TDurability.USE_DEFAULT;
@@ -1038,4 +1179,300 @@ public final class ThriftUtilities {
return out;
}
+
+ private static TConsistency consistencyFromHBase(Consistency consistency) {
+ switch (consistency) {
+ case STRONG: return TConsistency.STRONG;
+ case TIMELINE: return TConsistency.TIMELINE;
+ default: return TConsistency.STRONG;
+ }
+ }
+
+ public static TGet getFromHBase(Get in) {
+ TGet out = new TGet();
+ out.setRow(in.getRow());
+
+ TTimeRange tTimeRange = new TTimeRange();
+ tTimeRange.setMaxStamp(in.getTimeRange().getMax()).setMinStamp(in.getTimeRange().getMin());
+ out.setTimeRange(tTimeRange);
+ out.setMaxVersions(in.getMaxVersions());
+
+ for (Map.Entry<String, byte[]> attribute : in.getAttributesMap().entrySet()) {
+ out.putToAttributes(ByteBuffer.wrap(Bytes.toBytes(attribute.getKey())),
+ ByteBuffer.wrap(attribute.getValue()));
+ }
+ try {
+ Authorizations authorizations = in.getAuthorizations();
+ if (authorizations != null) {
+ TAuthorization tAuthorization = new TAuthorization();
+ tAuthorization.setLabels(authorizations.getLabels());
+ out.setAuthorizations(tAuthorization);
+ }
+ } catch (DeserializationException e) {
+ throw new RuntimeException(e);
+ }
+ out.setConsistency(consistencyFromHBase(in.getConsistency()));
+ out.setTargetReplicaId(in.getReplicaId());
+ out.setCacheBlocks(in.getCacheBlocks());
+ out.setStoreLimit(in.getMaxResultsPerColumnFamily());
+ out.setStoreOffset(in.getRowOffsetPerColumnFamily());
+ out.setExistence_only(in.isCheckExistenceOnly());
+ for (Map.Entry<byte[], NavigableSet<byte[]>> family : in.getFamilyMap().entrySet()) {
+
+ if (family.getValue() != null && !family.getValue().isEmpty()) {
+ for (byte[] qualifier : family.getValue()) {
+ TColumn column = new TColumn();
+ column.setFamily(family.getKey());
+ column.setQualifier(qualifier);
+ out.addToColumns(column);
+ }
+ } else {
+ TColumn column = new TColumn();
+ column.setFamily(family.getKey());
+ out.addToColumns(column);
+ }
+ }
+ if (in.getFilter() != null) {
+ try {
+ out.setFilterBytes(in.getFilter().toByteArray());
+ } catch (IOException ioE) {
+ throw new RuntimeException(ioE);
+ }
+ }
+ return out;
+ }
+
+ public static Cell toCell(ExtendedCellBuilder cellBuilder, byte[] row, TColumnValue columnValue) {
+ return cellBuilder.clear()
+ .setRow(row)
+ .setFamily(columnValue.getFamily())
+ .setQualifier(columnValue.getQualifier())
+ .setTimestamp(columnValue.getTimestamp())
+ .setType(columnValue.getType())
+ .setValue(columnValue.getValue())
+ .setTags(columnValue.getTags())
+ .build();
+ }
+
+
+
+
+
+
+
+ public static Result resultFromThrift(TResult in) {
+ if (in == null) {
+ return null;
+ }
+ if (!in.isSetColumnValues() || in.getColumnValues().isEmpty()){
+ return in.isStale() ? EMPTY_RESULT_STALE : EMPTY_RESULT;
+ }
+ List<Cell> cells = new ArrayList<>(in.getColumnValues().size());
+ ExtendedCellBuilder builder = ExtendedCellBuilderFactory.create(CellBuilderType.SHALLOW_COPY);
+ for (TColumnValue columnValue : in.getColumnValues()) {
+ cells.add(toCell(builder, in.getRow(), columnValue));
+ }
+ return Result.create(cells, null, in.isStale(), in.isPartial());
+ }
+
+ public static TPut putFromHBase(Put in) {
+ TPut out = new TPut();
+ out.setRow(in.getRow());
+ if (in.getTimestamp() != HConstants.LATEST_TIMESTAMP) {
+ out.setTimestamp(in.getTimestamp());
+ }
+ if (in.getDurability() != Durability.USE_DEFAULT) {
+ out.setDurability(durabilityFromHBase(in.getDurability()));
+ }
+ for (Map.Entry<byte [], List<Cell>> entry : in.getFamilyCellMap().entrySet()) {
+ byte[] family = entry.getKey();
+ for (Cell cell : entry.getValue()) {
+ TColumnValue columnValue = new TColumnValue();
+ columnValue.setFamily(family)
+ .setQualifier(CellUtil.cloneQualifier(cell))
+ .setType(cell.getType().getCode())
+ .setTimestamp(cell.getTimestamp())
+ .setValue(CellUtil.cloneValue(cell));
+ if (cell.getTagsLength() != 0) {
+ columnValue.setTags(CellUtil.cloneTags(cell));
+ }
+ out.addToColumnValues(columnValue);
+ }
+ }
+ for (Map.Entry<String, byte[]> attribute : in.getAttributesMap().entrySet()) {
+ out.putToAttributes(ByteBuffer.wrap(Bytes.toBytes(attribute.getKey())),
+ ByteBuffer.wrap(attribute.getValue()));
+ }
+ try {
+ CellVisibility cellVisibility = in.getCellVisibility();
+ if (cellVisibility != null) {
+ TCellVisibility tCellVisibility = new TCellVisibility();
+ tCellVisibility.setExpression(cellVisibility.getExpression());
+ out.setCellVisibility(tCellVisibility);
+ }
+ } catch (DeserializationException e) {
+ throw new RuntimeException(e);
+ }
+ return out;
+ }
+
+ public static List<TPut> putsFromHBase(List<Put> in) {
+ List<TPut> out = new ArrayList<>(in.size());
+ for (Put put : in) {
+ out.add(putFromHBase(put));
+ }
+ return out;
+ }
+
+ public static NamespaceDescriptor[] namespaceDescriptorsFromThrift(
+ List<TNamespaceDescriptor> in) {
+ NamespaceDescriptor[] out = new NamespaceDescriptor[in.size()];
+ int index = 0;
+ for (TNamespaceDescriptor descriptor : in) {
+ out[index++] = namespaceDescriptorFromThrift(descriptor);
+ }
+ return out;
+ }
+
+ public static List<TDelete> deletesFromHBase(List<Delete> in) {
+ List<TDelete> out = new ArrayList<>(in.size());
+ for (Delete delete : in) {
+ out.add(deleteFromHBase(delete));
+ }
+ return out;
+ }
+
+ public static TAppend appendFromHBase(Append in) throws IOException {
+ TAppend out = new TAppend();
+ out.setRow(in.getRow());
+
+ if (in.getDurability() != Durability.USE_DEFAULT) {
+ out.setDurability(durabilityFromHBase(in.getDurability()));
+ }
+ for (Map.Entry<byte [], List<Cell>> entry : in.getFamilyCellMap().entrySet()) {
+ byte[] family = entry.getKey();
+ for (Cell cell : entry.getValue()) {
+ TColumnValue columnValue = new TColumnValue();
+ columnValue.setFamily(family)
+ .setQualifier(CellUtil.cloneQualifier(cell))
+ .setType(cell.getType().getCode())
+ .setTimestamp(cell.getTimestamp())
+ .setValue(CellUtil.cloneValue(cell));
+ if (cell.getTagsLength() != 0) {
+ columnValue.setTags(CellUtil.cloneTags(cell));
+ }
+ out.addToColumns(columnValue);
+ }
+ }
+ for (Map.Entry<String, byte[]> attribute : in.getAttributesMap().entrySet()) {
+ out.putToAttributes(ByteBuffer.wrap(Bytes.toBytes(attribute.getKey())),
+ ByteBuffer.wrap(attribute.getValue()));
+ }
+ try {
+ CellVisibility cellVisibility = in.getCellVisibility();
+ if (cellVisibility != null) {
+ TCellVisibility tCellVisibility = new TCellVisibility();
+ tCellVisibility.setExpression(cellVisibility.getExpression());
+ out.setCellVisibility(tCellVisibility);
+ }
+ } catch (DeserializationException e) {
+ throw new RuntimeException(e);
+ }
+ out.setReturnResults(in.isReturnResults());
+ return out;
+ }
+
+ public static TIncrement incrementFromHBase(Increment in) throws IOException {
+ TIncrement out = new TIncrement();
+ out.setRow(in.getRow());
+
+ if (in.getDurability() != Durability.USE_DEFAULT) {
+ out.setDurability(durabilityFromHBase(in.getDurability()));
+ }
+ for (Map.Entry<byte [], List<Cell>> entry : in.getFamilyCellMap().entrySet()) {
+ byte[] family = entry.getKey();
+ for (Cell cell : entry.getValue()) {
+ TColumnIncrement columnValue = new TColumnIncrement();
+ columnValue.setFamily(family).setQualifier(CellUtil.cloneQualifier(cell));
+ columnValue.setAmount(
+ Bytes.toLong(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength()));
+ out.addToColumns(columnValue);
+ }
+ }
+ for (Map.Entry<String, byte[]> attribute : in.getAttributesMap().entrySet()) {
+ out.putToAttributes(ByteBuffer.wrap(Bytes.toBytes(attribute.getKey())),
+ ByteBuffer.wrap(attribute.getValue()));
+ }
+ try {
+ CellVisibility cellVisibility = in.getCellVisibility();
+ if (cellVisibility != null) {
+ TCellVisibility tCellVisibility = new TCellVisibility();
+ tCellVisibility.setExpression(cellVisibility.getExpression());
+ out.setCellVisibility(tCellVisibility);
+ }
+ } catch (DeserializationException e) {
+ throw new RuntimeException(e);
+ }
+ out.setReturnResults(in.isReturnResults());
+ return out;
+ }
+
+ public static TRowMutations rowMutationsFromHBase(RowMutations in) {
+ TRowMutations tRowMutations = new TRowMutations();
+ tRowMutations.setRow(in.getRow());
+ for (Mutation mutation : in.getMutations()) {
+ TMutation tMutation = new TMutation();
+ if (mutation instanceof Put) {
+ tMutation.setPut(ThriftUtilities.putFromHBase((Put)mutation));
+ } else if (mutation instanceof Delete) {
+ tMutation.setDeleteSingle(ThriftUtilities.deleteFromHBase((Delete)mutation));
+ } else {
+ throw new IllegalArgumentException(
+ "Only Put and Delete is supported in mutateRow, but muation=" + mutation);
+ }
+ tRowMutations.addToMutations(tMutation);
+ }
+ return tRowMutations;
+ }
+
+ public static TCompareOp compareOpFromHBase(CompareOperator compareOp) {
+ switch (compareOp) {
+ case LESS: return TCompareOp.LESS;
+ case LESS_OR_EQUAL: return TCompareOp.LESS_OR_EQUAL;
+ case EQUAL: return TCompareOp.EQUAL;
+ case NOT_EQUAL: return TCompareOp.NOT_EQUAL;
+ case GREATER_OR_EQUAL: return TCompareOp.GREATER_OR_EQUAL;
+ case GREATER: return TCompareOp.GREATER;
+ case NO_OP: return TCompareOp.NO_OP;
+ default: return null;
+ }
+ }
+ public static List<ByteBuffer> splitKeyFromHBase(byte[][] in) {
+ if (in == null || in.length == 0) {
+ return null;
+ }
+ List<ByteBuffer> out = new ArrayList<>(in.length);
+ for (byte[] key : in) {
+ out.add(ByteBuffer.wrap(key));
+ }
+ return out;
+ }
+
+ public static Result[] resultsFromThrift(List<TResult> in) {
+ Result[] out = new Result[in.size()];
+ int index = 0;
+ for (TResult tResult : in) {
+ out[index++] = resultFromThrift(tResult);
+ }
+ return out;
+ }
+
+ public static List<TGet> getsFromHBase(List<Get> in) {
+ List<TGet> out = new ArrayList<>(in.size());
+ for (Get get : in) {
+ out.add(getFromHBase(get));
+ }
+ return out;
+ }
+
}