HBASE-3513 upgrade thrift to 0.5.0 and use mvn version
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1078228 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4d28e95a61
commit
e27a683cac
@ -93,6 +93,7 @@ Release 0.91.0 - Unreleased
|
||||
causes tests not to run via not-maven
|
||||
HBASE-3586 Improve the selection of regions to balance (Ted Yu via Andrew
|
||||
Purtell)
|
||||
HBASE-3513 upgrade thrift to 0.5.0 and use mvn version
|
||||
|
||||
TASK
|
||||
HBASE-3559 Move report of split to master OFF the heartbeat channel
|
||||
|
10
pom.xml
10
pom.xml
@ -155,6 +155,10 @@
|
||||
</developers>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>apache release</id>
|
||||
<url>https://repository.apache.org/content/repositories/releases/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>temp-thrift</id>
|
||||
<name>Thrift 0.2.0</name>
|
||||
@ -522,7 +526,7 @@
|
||||
<protobuf.version>2.3.0</protobuf.version>
|
||||
<slf4j.version>1.5.8</slf4j.version><!-- newer version available -->
|
||||
<stax-api.version>1.0.1</stax-api.version>
|
||||
<thrift.version>0.2.0</thrift.version><!-- newer version available -->
|
||||
<thrift.version>0.5.0</thrift.version><!-- newer version available -->
|
||||
<zookeeper.version>3.3.2</zookeeper.version>
|
||||
</properties>
|
||||
|
||||
@ -630,8 +634,8 @@
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.thrift</groupId>
|
||||
<artifactId>thrift</artifactId>
|
||||
<groupId>org.apache.hadoop</groupId>
|
||||
<artifactId>libthrift</artifactId>
|
||||
<version>${thrift.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
|
@ -22,6 +22,7 @@ import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
@ -83,6 +84,8 @@ import org.apache.thrift.transport.TServerSocket;
|
||||
import org.apache.thrift.transport.TServerTransport;
|
||||
import org.apache.thrift.transport.TTransportFactory;
|
||||
|
||||
import static org.apache.hadoop.hbase.util.Bytes.getBytes;
|
||||
|
||||
/**
|
||||
* ThriftServer - this class starts up a Thrift server which implements the
|
||||
* Hbase API specified in the Hbase.thrift IDL file.
|
||||
@ -135,7 +138,7 @@ public class ThriftServer {
|
||||
* @throws IOException
|
||||
* @throws IOError
|
||||
*/
|
||||
protected HTable getTable(final byte[] tableName) throws IOError,
|
||||
protected HTable getTable(final byte[] tableName) throws
|
||||
IOException {
|
||||
String table = new String(tableName);
|
||||
Map<String, HTable> tables = threadLocalTables.get();
|
||||
@ -145,6 +148,10 @@ public class ThriftServer {
|
||||
return tables.get(table);
|
||||
}
|
||||
|
||||
protected HTable getTable(final ByteBuffer tableName) throws IOException {
|
||||
return getTable(getBytes(tableName));
|
||||
}
|
||||
|
||||
/**
|
||||
* Assigns a unique ID to the scanner and adds the mapping to an internal
|
||||
* hash-map.
|
||||
@ -181,7 +188,7 @@ public class ThriftServer {
|
||||
|
||||
/**
|
||||
* Constructs an HBaseHandler object.
|
||||
* @throws IOException
|
||||
* @throws IOException
|
||||
*/
|
||||
HBaseHandler()
|
||||
throws IOException {
|
||||
@ -195,33 +202,37 @@ public class ThriftServer {
|
||||
scannerMap = new HashMap<Integer, ResultScanner>();
|
||||
}
|
||||
|
||||
public void enableTable(final byte[] tableName) throws IOError {
|
||||
@Override
|
||||
public void enableTable(ByteBuffer tableName) throws IOError {
|
||||
try{
|
||||
admin.enableTable(tableName);
|
||||
admin.enableTable(getBytes(tableName));
|
||||
} catch (IOException e) {
|
||||
throw new IOError(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void disableTable(final byte[] tableName) throws IOError{
|
||||
@Override
|
||||
public void disableTable(ByteBuffer tableName) throws IOError{
|
||||
try{
|
||||
admin.disableTable(tableName);
|
||||
admin.disableTable(getBytes(tableName));
|
||||
} catch (IOException e) {
|
||||
throw new IOError(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isTableEnabled(final byte[] tableName) throws IOError {
|
||||
@Override
|
||||
public boolean isTableEnabled(ByteBuffer tableName) throws IOError {
|
||||
try {
|
||||
return HTable.isTableEnabled(this.conf, tableName);
|
||||
return HTable.isTableEnabled(this.conf, getBytes(tableName));
|
||||
} catch (IOException e) {
|
||||
throw new IOError(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void compact(byte[] tableNameOrRegionName) throws IOError {
|
||||
@Override
|
||||
public void compact(ByteBuffer tableNameOrRegionName) throws IOError {
|
||||
try{
|
||||
admin.compact(tableNameOrRegionName);
|
||||
admin.compact(getBytes(tableNameOrRegionName));
|
||||
} catch (InterruptedException e) {
|
||||
throw new IOError(e.getMessage());
|
||||
} catch (IOException e) {
|
||||
@ -229,9 +240,10 @@ public class ThriftServer {
|
||||
}
|
||||
}
|
||||
|
||||
public void majorCompact(byte[] tableNameOrRegionName) throws IOError {
|
||||
@Override
|
||||
public void majorCompact(ByteBuffer tableNameOrRegionName) throws IOError {
|
||||
try{
|
||||
admin.majorCompact(tableNameOrRegionName);
|
||||
admin.majorCompact(getBytes(tableNameOrRegionName));
|
||||
} catch (InterruptedException e) {
|
||||
throw new IOError(e.getMessage());
|
||||
} catch (IOException e) {
|
||||
@ -239,12 +251,13 @@ public class ThriftServer {
|
||||
}
|
||||
}
|
||||
|
||||
public List<byte[]> getTableNames() throws IOError {
|
||||
@Override
|
||||
public List<ByteBuffer> getTableNames() throws IOError {
|
||||
try {
|
||||
HTableDescriptor[] tables = this.admin.listTables();
|
||||
ArrayList<byte[]> list = new ArrayList<byte[]>(tables.length);
|
||||
ArrayList<ByteBuffer> list = new ArrayList<ByteBuffer>(tables.length);
|
||||
for (int i = 0; i < tables.length; i++) {
|
||||
list.add(tables[i].getName());
|
||||
list.add(ByteBuffer.wrap(tables[i].getName()));
|
||||
}
|
||||
return list;
|
||||
} catch (IOException e) {
|
||||
@ -252,7 +265,8 @@ public class ThriftServer {
|
||||
}
|
||||
}
|
||||
|
||||
public List<TRegionInfo> getTableRegions(byte[] tableName)
|
||||
@Override
|
||||
public List<TRegionInfo> getTableRegions(ByteBuffer tableName)
|
||||
throws IOError {
|
||||
try{
|
||||
HTable table = getTable(tableName);
|
||||
@ -261,10 +275,10 @@ public class ThriftServer {
|
||||
|
||||
for (HRegionInfo regionInfo : regionsInfo.keySet()){
|
||||
TRegionInfo region = new TRegionInfo();
|
||||
region.startKey = regionInfo.getStartKey();
|
||||
region.endKey = regionInfo.getEndKey();
|
||||
region.startKey = ByteBuffer.wrap(regionInfo.getStartKey());
|
||||
region.endKey = ByteBuffer.wrap(regionInfo.getEndKey());
|
||||
region.id = regionInfo.getRegionId();
|
||||
region.name = regionInfo.getRegionName();
|
||||
region.name = ByteBuffer.wrap(regionInfo.getRegionName());
|
||||
region.version = regionInfo.getVersion();
|
||||
regions.add(region);
|
||||
}
|
||||
@ -275,20 +289,23 @@ public class ThriftServer {
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public List<TCell> get(byte[] tableName, byte[] row, byte[] column)
|
||||
@Override
|
||||
public List<TCell> get(ByteBuffer tableName, ByteBuffer row, ByteBuffer column)
|
||||
throws IOError {
|
||||
byte [][] famAndQf = KeyValue.parseColumn(column);
|
||||
byte [][] famAndQf = KeyValue.parseColumn(getBytes(column));
|
||||
if(famAndQf.length == 1) {
|
||||
return get(tableName, row, famAndQf[0], new byte[0]);
|
||||
}
|
||||
return get(tableName, row, famAndQf[0], famAndQf[1]);
|
||||
}
|
||||
|
||||
public List<TCell> get(byte [] tableName, byte [] row, byte [] family,
|
||||
byte [] qualifier) throws IOError {
|
||||
protected List<TCell> get(ByteBuffer tableName,
|
||||
ByteBuffer row,
|
||||
byte[] family,
|
||||
byte[] qualifier) throws IOError {
|
||||
try {
|
||||
HTable table = getTable(tableName);
|
||||
Get get = new Get(row);
|
||||
Get get = new Get(getBytes(row));
|
||||
if (qualifier == null || qualifier.length == 0) {
|
||||
get.addFamily(family);
|
||||
} else {
|
||||
@ -302,20 +319,24 @@ public class ThriftServer {
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public List<TCell> getVer(byte[] tableName, byte[] row,
|
||||
byte[] column, int numVersions) throws IOError {
|
||||
byte [][] famAndQf = KeyValue.parseColumn(column);
|
||||
@Override
|
||||
public List<TCell> getVer(ByteBuffer tableName, ByteBuffer row,
|
||||
ByteBuffer column, int numVersions) throws IOError {
|
||||
byte [][] famAndQf = KeyValue.parseColumn(getBytes(column));
|
||||
if(famAndQf.length == 1) {
|
||||
return getVer(tableName, row, famAndQf[0], new byte[0], numVersions);
|
||||
return getVer(tableName, row, famAndQf[0],
|
||||
new byte[0], numVersions);
|
||||
}
|
||||
return getVer(tableName, row, famAndQf[0], famAndQf[1], numVersions);
|
||||
return getVer(tableName, row,
|
||||
famAndQf[0], famAndQf[1], numVersions);
|
||||
}
|
||||
|
||||
public List<TCell> getVer(byte [] tableName, byte [] row, byte [] family,
|
||||
byte [] qualifier, int numVersions) throws IOError {
|
||||
public List<TCell> getVer(ByteBuffer tableName, ByteBuffer row,
|
||||
byte[] family,
|
||||
byte[] qualifier, int numVersions) throws IOError {
|
||||
try {
|
||||
HTable table = getTable(tableName);
|
||||
Get get = new Get(row);
|
||||
Get get = new Get(getBytes(row));
|
||||
get.addColumn(family, qualifier);
|
||||
get.setMaxVersions(numVersions);
|
||||
Result result = table.get(get);
|
||||
@ -326,9 +347,13 @@ public class ThriftServer {
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public List<TCell> getVerTs(byte[] tableName, byte[] row,
|
||||
byte[] column, long timestamp, int numVersions) throws IOError {
|
||||
byte [][] famAndQf = KeyValue.parseColumn(column);
|
||||
@Override
|
||||
public List<TCell> getVerTs(ByteBuffer tableName,
|
||||
ByteBuffer row,
|
||||
ByteBuffer column,
|
||||
long timestamp,
|
||||
int numVersions) throws IOError {
|
||||
byte [][] famAndQf = KeyValue.parseColumn(getBytes(column));
|
||||
if(famAndQf.length == 1) {
|
||||
return getVerTs(tableName, row, famAndQf[0], new byte[0], timestamp,
|
||||
numVersions);
|
||||
@ -337,11 +362,12 @@ public class ThriftServer {
|
||||
numVersions);
|
||||
}
|
||||
|
||||
public List<TCell> getVerTs(byte [] tableName, byte [] row, byte [] family,
|
||||
protected List<TCell> getVerTs(ByteBuffer tableName,
|
||||
ByteBuffer row, byte [] family,
|
||||
byte [] qualifier, long timestamp, int numVersions) throws IOError {
|
||||
try {
|
||||
HTable table = getTable(tableName);
|
||||
Get get = new Get(row);
|
||||
Get get = new Get(getBytes(row));
|
||||
get.addColumn(family, qualifier);
|
||||
get.setTimeRange(Long.MIN_VALUE, timestamp);
|
||||
get.setMaxVersions(numVersions);
|
||||
@ -352,38 +378,42 @@ public class ThriftServer {
|
||||
}
|
||||
}
|
||||
|
||||
public List<TRowResult> getRow(byte[] tableName, byte[] row)
|
||||
@Override
|
||||
public List<TRowResult> getRow(ByteBuffer tableName, ByteBuffer row)
|
||||
throws IOError {
|
||||
return getRowWithColumnsTs(tableName, row, null,
|
||||
HConstants.LATEST_TIMESTAMP);
|
||||
}
|
||||
|
||||
public List<TRowResult> getRowWithColumns(byte[] tableName, byte[] row,
|
||||
List<byte[]> columns) throws IOError {
|
||||
@Override
|
||||
public List<TRowResult> getRowWithColumns(ByteBuffer tableName,
|
||||
ByteBuffer row,
|
||||
List<ByteBuffer> columns) throws IOError {
|
||||
return getRowWithColumnsTs(tableName, row, columns,
|
||||
HConstants.LATEST_TIMESTAMP);
|
||||
}
|
||||
|
||||
public List<TRowResult> getRowTs(byte[] tableName, byte[] row,
|
||||
@Override
|
||||
public List<TRowResult> getRowTs(ByteBuffer tableName, ByteBuffer row,
|
||||
long timestamp) throws IOError {
|
||||
return getRowWithColumnsTs(tableName, row, null,
|
||||
timestamp);
|
||||
}
|
||||
|
||||
public List<TRowResult> getRowWithColumnsTs(byte[] tableName, byte[] row,
|
||||
List<byte[]> columns, long timestamp) throws IOError {
|
||||
@Override
|
||||
public List<TRowResult> getRowWithColumnsTs(ByteBuffer tableName, ByteBuffer row,
|
||||
List<ByteBuffer> columns, long timestamp) throws IOError {
|
||||
try {
|
||||
HTable table = getTable(tableName);
|
||||
if (columns == null) {
|
||||
Get get = new Get(row);
|
||||
Get get = new Get(getBytes(row));
|
||||
get.setTimeRange(Long.MIN_VALUE, timestamp);
|
||||
Result result = table.get(get);
|
||||
return ThriftUtilities.rowResultFromHBase(result);
|
||||
}
|
||||
byte[][] columnArr = columns.toArray(new byte[columns.size()][]);
|
||||
Get get = new Get(row);
|
||||
for(byte [] column : columnArr) {
|
||||
byte [][] famAndQf = KeyValue.parseColumn(column);
|
||||
Get get = new Get(getBytes(row));
|
||||
for(ByteBuffer column : columns) {
|
||||
byte [][] famAndQf = KeyValue.parseColumn(getBytes(column));
|
||||
if (famAndQf.length == 1) {
|
||||
get.addFamily(famAndQf[0]);
|
||||
} else {
|
||||
@ -398,35 +428,43 @@ public class ThriftServer {
|
||||
}
|
||||
}
|
||||
|
||||
public List<TRowResult> getRows(byte[] tableName, List<byte[]> rows)
|
||||
@Override
|
||||
public List<TRowResult> getRows(ByteBuffer tableName,
|
||||
List<ByteBuffer> rows)
|
||||
throws IOError {
|
||||
return getRowsWithColumnsTs(tableName, rows, null,
|
||||
HConstants.LATEST_TIMESTAMP);
|
||||
}
|
||||
|
||||
public List<TRowResult> getRowsWithColumns(byte[] tableName, List<byte[]> rows,
|
||||
List<byte[]> columns) throws IOError {
|
||||
@Override
|
||||
public List<TRowResult> getRowsWithColumns(ByteBuffer tableName,
|
||||
List<ByteBuffer> rows,
|
||||
List<ByteBuffer> columns) throws IOError {
|
||||
return getRowsWithColumnsTs(tableName, rows, columns,
|
||||
HConstants.LATEST_TIMESTAMP);
|
||||
}
|
||||
|
||||
public List<TRowResult> getRowsTs(byte[] tableName, List<byte[]> rows,
|
||||
@Override
|
||||
public List<TRowResult> getRowsTs(ByteBuffer tableName,
|
||||
List<ByteBuffer> rows,
|
||||
long timestamp) throws IOError {
|
||||
return getRowsWithColumnsTs(tableName, rows, null,
|
||||
timestamp);
|
||||
}
|
||||
|
||||
public List<TRowResult> getRowsWithColumnsTs(byte[] tableName, List<byte[]> rows,
|
||||
List<byte[]> columns, long timestamp) throws IOError {
|
||||
@Override
|
||||
public List<TRowResult> getRowsWithColumnsTs(ByteBuffer tableName,
|
||||
List<ByteBuffer> rows,
|
||||
List<ByteBuffer> columns, long timestamp) throws IOError {
|
||||
try {
|
||||
List<Get> gets = new ArrayList<Get>(rows.size());
|
||||
HTable table = getTable(tableName);
|
||||
for (byte[] row : rows) {
|
||||
Get get = new Get(row);
|
||||
for (ByteBuffer row : rows) {
|
||||
Get get = new Get(getBytes(row));
|
||||
if (columns != null) {
|
||||
byte[][] columnArr = columns.toArray(new byte[columns.size()][]);
|
||||
for(byte [] column : columnArr) {
|
||||
byte [][] famAndQf = KeyValue.parseColumn(column);
|
||||
|
||||
for(ByteBuffer column : columns) {
|
||||
byte [][] famAndQf = KeyValue.parseColumn(getBytes(column));
|
||||
if (famAndQf.length == 1) {
|
||||
get.addFamily(famAndQf[0]);
|
||||
} else {
|
||||
@ -444,17 +482,21 @@ public class ThriftServer {
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteAll(byte[] tableName, byte[] row, byte[] column)
|
||||
@Override
|
||||
public void deleteAll(ByteBuffer tableName, ByteBuffer row, ByteBuffer column)
|
||||
throws IOError {
|
||||
deleteAllTs(tableName, row, column, HConstants.LATEST_TIMESTAMP);
|
||||
}
|
||||
|
||||
public void deleteAllTs(byte[] tableName, byte[] row, byte[] column,
|
||||
@Override
|
||||
public void deleteAllTs(ByteBuffer tableName,
|
||||
ByteBuffer row,
|
||||
ByteBuffer column,
|
||||
long timestamp) throws IOError {
|
||||
try {
|
||||
HTable table = getTable(tableName);
|
||||
Delete delete = new Delete(row);
|
||||
byte [][] famAndQf = KeyValue.parseColumn(column);
|
||||
Delete delete = new Delete(getBytes(row));
|
||||
byte [][] famAndQf = KeyValue.parseColumn(getBytes(column));
|
||||
if (famAndQf.length == 1) {
|
||||
delete.deleteFamily(famAndQf[0], timestamp);
|
||||
} else {
|
||||
@ -467,24 +509,28 @@ public class ThriftServer {
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteAllRow(byte[] tableName, byte[] row) throws IOError {
|
||||
@Override
|
||||
public void deleteAllRow(ByteBuffer tableName, ByteBuffer row) throws IOError {
|
||||
deleteAllRowTs(tableName, row, HConstants.LATEST_TIMESTAMP);
|
||||
}
|
||||
|
||||
public void deleteAllRowTs(byte[] tableName, byte[] row, long timestamp)
|
||||
@Override
|
||||
public void deleteAllRowTs(ByteBuffer tableName, ByteBuffer row, long timestamp)
|
||||
throws IOError {
|
||||
try {
|
||||
HTable table = getTable(tableName);
|
||||
Delete delete = new Delete(row, timestamp, null);
|
||||
Delete delete = new Delete(getBytes(row), timestamp, null);
|
||||
table.delete(delete);
|
||||
} catch (IOException e) {
|
||||
throw new IOError(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void createTable(byte[] tableName,
|
||||
@Override
|
||||
public void createTable(ByteBuffer in_tableName,
|
||||
List<ColumnDescriptor> columnFamilies) throws IOError,
|
||||
IllegalArgument, AlreadyExists {
|
||||
byte [] tableName = getBytes(in_tableName);
|
||||
try {
|
||||
if (admin.tableExists(tableName)) {
|
||||
throw new AlreadyExists("table name already in use");
|
||||
@ -502,9 +548,11 @@ public class ThriftServer {
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteTable(byte[] tableName) throws IOError {
|
||||
@Override
|
||||
public void deleteTable(ByteBuffer in_tableName) throws IOError {
|
||||
byte [] tableName = getBytes(in_tableName);
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("deleteTable: table=" + new String(tableName));
|
||||
LOG.debug("deleteTable: table=" + Bytes.toString(tableName));
|
||||
}
|
||||
try {
|
||||
if (!admin.tableExists(tableName)) {
|
||||
@ -516,23 +564,25 @@ public class ThriftServer {
|
||||
}
|
||||
}
|
||||
|
||||
public void mutateRow(byte[] tableName, byte[] row,
|
||||
@Override
|
||||
public void mutateRow(ByteBuffer tableName, ByteBuffer row,
|
||||
List<Mutation> mutations) throws IOError, IllegalArgument {
|
||||
mutateRowTs(tableName, row, mutations, HConstants.LATEST_TIMESTAMP);
|
||||
}
|
||||
|
||||
public void mutateRowTs(byte[] tableName, byte[] row,
|
||||
@Override
|
||||
public void mutateRowTs(ByteBuffer tableName, ByteBuffer row,
|
||||
List<Mutation> mutations, long timestamp) throws IOError, IllegalArgument {
|
||||
HTable table = null;
|
||||
try {
|
||||
table = getTable(tableName);
|
||||
Put put = new Put(row, timestamp, null);
|
||||
Put put = new Put(getBytes(row), timestamp, null);
|
||||
|
||||
Delete delete = new Delete(row);
|
||||
Delete delete = new Delete(getBytes(row));
|
||||
|
||||
// I apologize for all this mess :)
|
||||
for (Mutation m : mutations) {
|
||||
byte[][] famAndQf = KeyValue.parseColumn(m.column);
|
||||
byte[][] famAndQf = KeyValue.parseColumn(getBytes(m.column));
|
||||
if (m.isDelete) {
|
||||
if (famAndQf.length == 1) {
|
||||
delete.deleteFamily(famAndQf[0], timestamp);
|
||||
@ -541,9 +591,9 @@ public class ThriftServer {
|
||||
}
|
||||
} else {
|
||||
if(famAndQf.length == 1) {
|
||||
put.add(famAndQf[0], new byte[0], m.value);
|
||||
put.add(famAndQf[0], new byte[0], getBytes(m.value));
|
||||
} else {
|
||||
put.add(famAndQf[0], famAndQf[1], m.value);
|
||||
put.add(famAndQf[0], famAndQf[1], getBytes(m.value));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -558,23 +608,25 @@ public class ThriftServer {
|
||||
}
|
||||
}
|
||||
|
||||
public void mutateRows(byte[] tableName, List<BatchMutation> rowBatches)
|
||||
@Override
|
||||
public void mutateRows(ByteBuffer tableName, List<BatchMutation> rowBatches)
|
||||
throws IOError, IllegalArgument, TException {
|
||||
mutateRowsTs(tableName, rowBatches, HConstants.LATEST_TIMESTAMP);
|
||||
}
|
||||
|
||||
public void mutateRowsTs(byte[] tableName, List<BatchMutation> rowBatches, long timestamp)
|
||||
@Override
|
||||
public void mutateRowsTs(ByteBuffer tableName, List<BatchMutation> rowBatches, long timestamp)
|
||||
throws IOError, IllegalArgument, TException {
|
||||
List<Put> puts = new ArrayList<Put>();
|
||||
List<Delete> deletes = new ArrayList<Delete>();
|
||||
|
||||
for (BatchMutation batch : rowBatches) {
|
||||
byte[] row = batch.row;
|
||||
byte[] row = getBytes(batch.row);
|
||||
List<Mutation> mutations = batch.mutations;
|
||||
Delete delete = new Delete(row);
|
||||
Put put = new Put(row, timestamp, null);
|
||||
for (Mutation m : mutations) {
|
||||
byte[][] famAndQf = KeyValue.parseColumn(m.column);
|
||||
byte[][] famAndQf = KeyValue.parseColumn(getBytes(m.column));
|
||||
if (m.isDelete) {
|
||||
// no qualifier, family only.
|
||||
if (famAndQf.length == 1) {
|
||||
@ -584,9 +636,9 @@ public class ThriftServer {
|
||||
}
|
||||
} else {
|
||||
if(famAndQf.length == 1) {
|
||||
put.add(famAndQf[0], new byte[0], m.value);
|
||||
put.add(famAndQf[0], new byte[0], getBytes(m.value));
|
||||
} else {
|
||||
put.add(famAndQf[0], famAndQf[1], m.value);
|
||||
put.add(famAndQf[0], famAndQf[1], getBytes(m.value));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -612,9 +664,10 @@ public class ThriftServer {
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public long atomicIncrement(byte[] tableName, byte[] row, byte[] column,
|
||||
@Override
|
||||
public long atomicIncrement(ByteBuffer tableName, ByteBuffer row, ByteBuffer column,
|
||||
long amount) throws IOError, IllegalArgument, TException {
|
||||
byte [][] famAndQf = KeyValue.parseColumn(column);
|
||||
byte [][] famAndQf = KeyValue.parseColumn(getBytes(column));
|
||||
if(famAndQf.length == 1) {
|
||||
return atomicIncrement(tableName, row, famAndQf[0], new byte[0],
|
||||
amount);
|
||||
@ -622,13 +675,13 @@ public class ThriftServer {
|
||||
return atomicIncrement(tableName, row, famAndQf[0], famAndQf[1], amount);
|
||||
}
|
||||
|
||||
public long atomicIncrement(byte [] tableName, byte [] row, byte [] family,
|
||||
protected long atomicIncrement(ByteBuffer tableName, ByteBuffer row, byte [] family,
|
||||
byte [] qualifier, long amount)
|
||||
throws IOError, IllegalArgument, TException {
|
||||
HTable table;
|
||||
try {
|
||||
table = getTable(tableName);
|
||||
return table.incrementColumnValue(row, family, qualifier, amount);
|
||||
return table.incrementColumnValue(getBytes(row), family, qualifier, amount);
|
||||
} catch (IOException e) {
|
||||
throw new IOError(e.getMessage());
|
||||
}
|
||||
@ -644,6 +697,7 @@ public class ThriftServer {
|
||||
removeScanner(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TRowResult> scannerGetList(int id,int nbRows) throws IllegalArgument, IOError {
|
||||
LOG.debug("scannerGetList: id=" + id);
|
||||
ResultScanner scanner = getScanner(id);
|
||||
@ -662,17 +716,19 @@ public class ThriftServer {
|
||||
}
|
||||
return ThriftUtilities.rowResultFromHBase(results);
|
||||
}
|
||||
@Override
|
||||
public List<TRowResult> scannerGet(int id) throws IllegalArgument, IOError {
|
||||
return scannerGetList(id,1);
|
||||
}
|
||||
public int scannerOpen(byte[] tableName, byte[] startRow,
|
||||
List<byte[]> columns) throws IOError {
|
||||
@Override
|
||||
public int scannerOpen(ByteBuffer tableName, ByteBuffer startRow,
|
||||
List<ByteBuffer> columns) throws IOError {
|
||||
try {
|
||||
HTable table = getTable(tableName);
|
||||
Scan scan = new Scan(startRow);
|
||||
Scan scan = new Scan(getBytes(startRow));
|
||||
if(columns != null && columns.size() != 0) {
|
||||
for(byte [] column : columns) {
|
||||
byte [][] famQf = KeyValue.parseColumn(column);
|
||||
for(ByteBuffer column : columns) {
|
||||
byte [][] famQf = KeyValue.parseColumn(getBytes(column));
|
||||
if(famQf.length == 1) {
|
||||
scan.addFamily(famQf[0]);
|
||||
} else {
|
||||
@ -686,14 +742,15 @@ public class ThriftServer {
|
||||
}
|
||||
}
|
||||
|
||||
public int scannerOpenWithStop(byte[] tableName, byte[] startRow,
|
||||
byte[] stopRow, List<byte[]> columns) throws IOError, TException {
|
||||
@Override
|
||||
public int scannerOpenWithStop(ByteBuffer tableName, ByteBuffer startRow,
|
||||
ByteBuffer stopRow, List<ByteBuffer> columns) throws IOError, TException {
|
||||
try {
|
||||
HTable table = getTable(tableName);
|
||||
Scan scan = new Scan(startRow, stopRow);
|
||||
Scan scan = new Scan(getBytes(startRow), getBytes(stopRow));
|
||||
if(columns != null && columns.size() != 0) {
|
||||
for(byte [] column : columns) {
|
||||
byte [][] famQf = KeyValue.parseColumn(column);
|
||||
for(ByteBuffer column : columns) {
|
||||
byte [][] famQf = KeyValue.parseColumn(getBytes(column));
|
||||
if(famQf.length == 1) {
|
||||
scan.addFamily(famQf[0]);
|
||||
} else {
|
||||
@ -708,61 +765,66 @@ public class ThriftServer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int scannerOpenWithPrefix(byte[] tableName, byte[] startAndPrefix, List<byte[]> columns) throws IOError, TException {
|
||||
try {
|
||||
HTable table = getTable(tableName);
|
||||
Scan scan = new Scan(startAndPrefix);
|
||||
Filter f = new WhileMatchFilter(
|
||||
new PrefixFilter(startAndPrefix));
|
||||
scan.setFilter(f);
|
||||
if(columns != null && columns.size() != 0) {
|
||||
for(byte [] column : columns) {
|
||||
byte [][] famQf = KeyValue.parseColumn(column);
|
||||
if(famQf.length == 1) {
|
||||
scan.addFamily(famQf[0]);
|
||||
} else {
|
||||
scan.addColumn(famQf[0], famQf[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return addScanner(table.getScanner(scan));
|
||||
} catch (IOException e) {
|
||||
throw new IOError(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public int scannerOpenTs(byte[] tableName, byte[] startRow,
|
||||
List<byte[]> columns, long timestamp) throws IOError, TException {
|
||||
try {
|
||||
HTable table = getTable(tableName);
|
||||
Scan scan = new Scan(startRow);
|
||||
scan.setTimeRange(Long.MIN_VALUE, timestamp);
|
||||
if(columns != null && columns.size() != 0) {
|
||||
for(byte [] column : columns) {
|
||||
byte [][] famQf = KeyValue.parseColumn(column);
|
||||
if(famQf.length == 1) {
|
||||
scan.addFamily(famQf[0]);
|
||||
} else {
|
||||
scan.addColumn(famQf[0], famQf[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return addScanner(table.getScanner(scan));
|
||||
} catch (IOException e) {
|
||||
throw new IOError(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public int scannerOpenWithStopTs(byte[] tableName, byte[] startRow,
|
||||
byte[] stopRow, List<byte[]> columns, long timestamp)
|
||||
public int scannerOpenWithPrefix(ByteBuffer tableName,
|
||||
ByteBuffer startAndPrefix,
|
||||
List<ByteBuffer> columns)
|
||||
throws IOError, TException {
|
||||
try {
|
||||
HTable table = getTable(tableName);
|
||||
Scan scan = new Scan(startRow, stopRow);
|
||||
Scan scan = new Scan(getBytes(startAndPrefix));
|
||||
Filter f = new WhileMatchFilter(
|
||||
new PrefixFilter(getBytes(startAndPrefix)));
|
||||
scan.setFilter(f);
|
||||
if(columns != null && columns.size() != 0) {
|
||||
for(ByteBuffer column : columns) {
|
||||
byte [][] famQf = KeyValue.parseColumn(getBytes(column));
|
||||
if(famQf.length == 1) {
|
||||
scan.addFamily(famQf[0]);
|
||||
} else {
|
||||
scan.addColumn(famQf[0], famQf[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return addScanner(table.getScanner(scan));
|
||||
} catch (IOException e) {
|
||||
throw new IOError(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int scannerOpenTs(ByteBuffer tableName, ByteBuffer startRow,
|
||||
List<ByteBuffer> columns, long timestamp) throws IOError, TException {
|
||||
try {
|
||||
HTable table = getTable(tableName);
|
||||
Scan scan = new Scan(getBytes(startRow));
|
||||
scan.setTimeRange(Long.MIN_VALUE, timestamp);
|
||||
if(columns != null && columns.size() != 0) {
|
||||
for(byte [] column : columns) {
|
||||
byte [][] famQf = KeyValue.parseColumn(column);
|
||||
for(ByteBuffer column : columns) {
|
||||
byte [][] famQf = KeyValue.parseColumn(getBytes(column));
|
||||
if(famQf.length == 1) {
|
||||
scan.addFamily(famQf[0]);
|
||||
} else {
|
||||
scan.addColumn(famQf[0], famQf[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return addScanner(table.getScanner(scan));
|
||||
} catch (IOException e) {
|
||||
throw new IOError(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int scannerOpenWithStopTs(ByteBuffer tableName, ByteBuffer startRow,
|
||||
ByteBuffer stopRow, List<ByteBuffer> columns, long timestamp)
|
||||
throws IOError, TException {
|
||||
try {
|
||||
HTable table = getTable(tableName);
|
||||
Scan scan = new Scan(getBytes(startRow), getBytes(stopRow));
|
||||
scan.setTimeRange(Long.MIN_VALUE, timestamp);
|
||||
if(columns != null && columns.size() != 0) {
|
||||
for(ByteBuffer column : columns) {
|
||||
byte [][] famQf = KeyValue.parseColumn(getBytes(column));
|
||||
if(famQf.length == 1) {
|
||||
scan.addFamily(famQf[0]);
|
||||
} else {
|
||||
@ -777,11 +839,12 @@ public class ThriftServer {
|
||||
}
|
||||
}
|
||||
|
||||
public Map<byte[], ColumnDescriptor> getColumnDescriptors(
|
||||
byte[] tableName) throws IOError, TException {
|
||||
@Override
|
||||
public Map<ByteBuffer, ColumnDescriptor> getColumnDescriptors(
|
||||
ByteBuffer tableName) throws IOError, TException {
|
||||
try {
|
||||
TreeMap<byte[], ColumnDescriptor> columns =
|
||||
new TreeMap<byte[], ColumnDescriptor>(Bytes.BYTES_COMPARATOR);
|
||||
TreeMap<ByteBuffer, ColumnDescriptor> columns =
|
||||
new TreeMap<ByteBuffer, ColumnDescriptor>();
|
||||
|
||||
HTable table = getTable(tableName);
|
||||
HTableDescriptor desc = table.getTableDescriptor();
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
package org.apache.hadoop.hbase.thrift;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.TreeMap;
|
||||
@ -52,10 +53,10 @@ public class ThriftUtilities {
|
||||
StoreFile.BloomType bt =
|
||||
BloomType.valueOf(in.bloomFilterType);
|
||||
|
||||
if (in.name == null || in.name.length <= 0) {
|
||||
if (in.name == null || !in.name.hasRemaining()) {
|
||||
throw new IllegalArgument("column name is empty");
|
||||
}
|
||||
byte [] parsedName = KeyValue.parseColumn(in.name)[0];
|
||||
byte [] parsedName = KeyValue.parseColumn(Bytes.getBytes(in.name))[0];
|
||||
HColumnDescriptor col = new HColumnDescriptor(parsedName,
|
||||
in.maxVersions, comp.getName(), in.inMemory, in.blockCacheEnabled,
|
||||
in.timeToLive, bt.toString());
|
||||
@ -72,7 +73,7 @@ public class ThriftUtilities {
|
||||
*/
|
||||
static public ColumnDescriptor colDescFromHbase(HColumnDescriptor in) {
|
||||
ColumnDescriptor col = new ColumnDescriptor();
|
||||
col.name = Bytes.add(in.getName(), KeyValue.COLUMN_FAMILY_DELIM_ARRAY);
|
||||
col.name = ByteBuffer.wrap(Bytes.add(in.getName(), KeyValue.COLUMN_FAMILY_DELIM_ARRAY));
|
||||
col.maxVersions = in.getMaxVersions();
|
||||
col.compression = in.getCompression().toString();
|
||||
col.inMemory = in.isInMemory();
|
||||
@ -92,7 +93,7 @@ public class ThriftUtilities {
|
||||
static public List<TCell> cellFromHBase(KeyValue in) {
|
||||
List<TCell> list = new ArrayList<TCell>(1);
|
||||
if (in != null) {
|
||||
list.add(new TCell(in.getValue(), in.getTimestamp()));
|
||||
list.add(new TCell(ByteBuffer.wrap(in.getValue()), in.getTimestamp()));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@ -108,7 +109,7 @@ public class ThriftUtilities {
|
||||
if (in != null) {
|
||||
list = new ArrayList<TCell>(in.length);
|
||||
for (int i = 0; i < in.length; i++) {
|
||||
list.add(new TCell(in[i].getValue(), in[i].getTimestamp()));
|
||||
list.add(new TCell(ByteBuffer.wrap(in[i].getValue()), in[i].getTimestamp()));
|
||||
}
|
||||
} else {
|
||||
list = new ArrayList<TCell>(0);
|
||||
@ -132,13 +133,15 @@ public class ThriftUtilities {
|
||||
continue;
|
||||
}
|
||||
TRowResult result = new TRowResult();
|
||||
result.row = result_.getRow();
|
||||
result.columns = new TreeMap<byte[], TCell>(Bytes.BYTES_COMPARATOR);
|
||||
result.row = ByteBuffer.wrap(result_.getRow());
|
||||
result.columns = new TreeMap<ByteBuffer, TCell>();
|
||||
for(KeyValue kv : result_.sorted()) {
|
||||
result.columns.put(KeyValue.makeColumn(kv.getFamily(),
|
||||
kv.getQualifier()), new TCell(kv.getValue(), kv.getTimestamp()));
|
||||
result.columns.put(
|
||||
ByteBuffer.wrap(KeyValue.makeColumn(kv.getFamily(),
|
||||
kv.getQualifier())),
|
||||
new TCell(ByteBuffer.wrap(kv.getValue()), kv.getTimestamp()));
|
||||
}
|
||||
results.add(result);
|
||||
results.add(result);
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
@ -17,19 +17,32 @@
|
||||
*/
|
||||
package org.apache.hadoop.hbase.thrift.generated;
|
||||
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
import org.apache.thrift.*;
|
||||
import org.apache.thrift.meta_data.FieldMetaData;
|
||||
import org.apache.thrift.meta_data.FieldValueMetaData;
|
||||
import org.apache.thrift.protocol.*;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.EnumMap;
|
||||
import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Collections;
|
||||
import java.util.BitSet;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Arrays;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.*;
|
||||
import org.apache.thrift.*;
|
||||
import org.apache.thrift.async.*;
|
||||
import org.apache.thrift.meta_data.*;
|
||||
import org.apache.thrift.transport.*;
|
||||
import org.apache.thrift.protocol.*;
|
||||
|
||||
/**
|
||||
* An AlreadyExists exceptions signals that a table with the specified
|
||||
* name already exists
|
||||
*/
|
||||
public class AlreadyExists extends Exception implements TBase<AlreadyExists._Fields>, java.io.Serializable, Cloneable, Comparable<AlreadyExists> {
|
||||
public class AlreadyExists extends Exception implements TBase<AlreadyExists, AlreadyExists._Fields>, java.io.Serializable, Cloneable {
|
||||
private static final TStruct STRUCT_DESC = new TStruct("AlreadyExists");
|
||||
|
||||
private static final TField MESSAGE_FIELD_DESC = new TField("message", TType.STRING, (short)1);
|
||||
@ -40,12 +53,10 @@ public class AlreadyExists extends Exception implements TBase<AlreadyExists._Fie
|
||||
public enum _Fields implements TFieldIdEnum {
|
||||
MESSAGE((short)1, "message");
|
||||
|
||||
private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
|
||||
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
|
||||
|
||||
static {
|
||||
for (_Fields field : EnumSet.allOf(_Fields.class)) {
|
||||
byId.put((int)field._thriftId, field);
|
||||
byName.put(field.getFieldName(), field);
|
||||
}
|
||||
}
|
||||
@ -54,7 +65,12 @@ public class AlreadyExists extends Exception implements TBase<AlreadyExists._Fie
|
||||
* Find the _Fields constant that matches fieldId, or null if its not found.
|
||||
*/
|
||||
public static _Fields findByThriftId(int fieldId) {
|
||||
return byId.get(fieldId);
|
||||
switch(fieldId) {
|
||||
case 1: // MESSAGE
|
||||
return MESSAGE;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -93,12 +109,12 @@ public class AlreadyExists extends Exception implements TBase<AlreadyExists._Fie
|
||||
|
||||
// isset id assignments
|
||||
|
||||
public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
|
||||
put(_Fields.MESSAGE, new FieldMetaData("message", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.STRING)));
|
||||
}});
|
||||
|
||||
public static final Map<_Fields, FieldMetaData> metaDataMap;
|
||||
static {
|
||||
Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class);
|
||||
tmpMap.put(_Fields.MESSAGE, new FieldMetaData("message", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.STRING)));
|
||||
metaDataMap = Collections.unmodifiableMap(tmpMap);
|
||||
FieldMetaData.addStructMetaDataMap(AlreadyExists.class, metaDataMap);
|
||||
}
|
||||
|
||||
@ -125,9 +141,9 @@ public class AlreadyExists extends Exception implements TBase<AlreadyExists._Fie
|
||||
return new AlreadyExists(this);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public AlreadyExists clone() {
|
||||
return new AlreadyExists(this);
|
||||
@Override
|
||||
public void clear() {
|
||||
this.message = null;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
@ -167,10 +183,6 @@ public class AlreadyExists extends Exception implements TBase<AlreadyExists._Fie
|
||||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(int fieldID, Object value) {
|
||||
setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
|
||||
}
|
||||
|
||||
public Object getFieldValue(_Fields field) {
|
||||
switch (field) {
|
||||
case MESSAGE:
|
||||
@ -180,12 +192,12 @@ public class AlreadyExists extends Exception implements TBase<AlreadyExists._Fie
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public Object getFieldValue(int fieldId) {
|
||||
return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
|
||||
}
|
||||
|
||||
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
|
||||
public boolean isSet(_Fields field) {
|
||||
if (field == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
switch (field) {
|
||||
case MESSAGE:
|
||||
return isSetMessage();
|
||||
@ -193,10 +205,6 @@ public class AlreadyExists extends Exception implements TBase<AlreadyExists._Fie
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public boolean isSet(int fieldID) {
|
||||
return isSet(_Fields.findByThriftIdOrThrow(fieldID));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that == null)
|
||||
@ -224,14 +232,7 @@ public class AlreadyExists extends Exception implements TBase<AlreadyExists._Fie
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
HashCodeBuilder builder = new HashCodeBuilder();
|
||||
|
||||
boolean present_message = true && (isSetMessage());
|
||||
builder.append(present_message);
|
||||
if (present_message)
|
||||
builder.append(message);
|
||||
|
||||
return builder.toHashCode();
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int compareTo(AlreadyExists other) {
|
||||
@ -242,17 +243,23 @@ public class AlreadyExists extends Exception implements TBase<AlreadyExists._Fie
|
||||
int lastComparison = 0;
|
||||
AlreadyExists typedOther = (AlreadyExists)other;
|
||||
|
||||
lastComparison = Boolean.valueOf(isSetMessage()).compareTo(isSetMessage());
|
||||
lastComparison = Boolean.valueOf(isSetMessage()).compareTo(typedOther.isSetMessage());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
lastComparison = TBaseHelper.compareTo(message, typedOther.message);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
if (isSetMessage()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.message, typedOther.message);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public _Fields fieldForId(int fieldId) {
|
||||
return _Fields.findByThriftId(fieldId);
|
||||
}
|
||||
|
||||
public void read(TProtocol iprot) throws TException {
|
||||
TField field;
|
||||
iprot.readStructBegin();
|
||||
@ -262,21 +269,18 @@ public class AlreadyExists extends Exception implements TBase<AlreadyExists._Fie
|
||||
if (field.type == TType.STOP) {
|
||||
break;
|
||||
}
|
||||
_Fields fieldId = _Fields.findByThriftId(field.id);
|
||||
if (fieldId == null) {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
} else {
|
||||
switch (fieldId) {
|
||||
case MESSAGE:
|
||||
if (field.type == TType.STRING) {
|
||||
this.message = iprot.readString();
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
}
|
||||
iprot.readFieldEnd();
|
||||
switch (field.id) {
|
||||
case 1: // MESSAGE
|
||||
if (field.type == TType.STRING) {
|
||||
this.message = iprot.readString();
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
iprot.readFieldEnd();
|
||||
}
|
||||
iprot.readStructEnd();
|
||||
|
||||
|
@ -17,7 +17,6 @@
|
||||
*/
|
||||
package org.apache.hadoop.hbase.thrift.generated;
|
||||
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
@ -28,24 +27,27 @@ import java.util.HashSet;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Collections;
|
||||
import java.util.BitSet;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Arrays;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.apache.thrift.*;
|
||||
import org.apache.thrift.async.*;
|
||||
import org.apache.thrift.meta_data.*;
|
||||
import org.apache.thrift.transport.*;
|
||||
import org.apache.thrift.protocol.*;
|
||||
|
||||
/**
|
||||
* A BatchMutation object is used to apply a number of Mutations to a single row.
|
||||
*/
|
||||
public class BatchMutation implements TBase<BatchMutation._Fields>, java.io.Serializable, Cloneable, Comparable<BatchMutation> {
|
||||
public class BatchMutation implements TBase<BatchMutation, BatchMutation._Fields>, java.io.Serializable, Cloneable {
|
||||
private static final TStruct STRUCT_DESC = new TStruct("BatchMutation");
|
||||
|
||||
private static final TField ROW_FIELD_DESC = new TField("row", TType.STRING, (short)1);
|
||||
private static final TField MUTATIONS_FIELD_DESC = new TField("mutations", TType.LIST, (short)2);
|
||||
|
||||
public byte[] row;
|
||||
public ByteBuffer row;
|
||||
public List<Mutation> mutations;
|
||||
|
||||
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
|
||||
@ -53,12 +55,10 @@ public class BatchMutation implements TBase<BatchMutation._Fields>, java.io.Seri
|
||||
ROW((short)1, "row"),
|
||||
MUTATIONS((short)2, "mutations");
|
||||
|
||||
private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
|
||||
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
|
||||
|
||||
static {
|
||||
for (_Fields field : EnumSet.allOf(_Fields.class)) {
|
||||
byId.put((int)field._thriftId, field);
|
||||
byName.put(field.getFieldName(), field);
|
||||
}
|
||||
}
|
||||
@ -67,7 +67,14 @@ public class BatchMutation implements TBase<BatchMutation._Fields>, java.io.Seri
|
||||
* Find the _Fields constant that matches fieldId, or null if its not found.
|
||||
*/
|
||||
public static _Fields findByThriftId(int fieldId) {
|
||||
return byId.get(fieldId);
|
||||
switch(fieldId) {
|
||||
case 1: // ROW
|
||||
return ROW;
|
||||
case 2: // MUTATIONS
|
||||
return MUTATIONS;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -106,15 +113,15 @@ public class BatchMutation implements TBase<BatchMutation._Fields>, java.io.Seri
|
||||
|
||||
// isset id assignments
|
||||
|
||||
public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
|
||||
put(_Fields.ROW, new FieldMetaData("row", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.STRING)));
|
||||
put(_Fields.MUTATIONS, new FieldMetaData("mutations", TFieldRequirementType.DEFAULT,
|
||||
public static final Map<_Fields, FieldMetaData> metaDataMap;
|
||||
static {
|
||||
Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class);
|
||||
tmpMap.put(_Fields.ROW, new FieldMetaData("row", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.STRING , "Text")));
|
||||
tmpMap.put(_Fields.MUTATIONS, new FieldMetaData("mutations", TFieldRequirementType.DEFAULT,
|
||||
new ListMetaData(TType.LIST,
|
||||
new StructMetaData(TType.STRUCT, Mutation.class))));
|
||||
}});
|
||||
|
||||
static {
|
||||
metaDataMap = Collections.unmodifiableMap(tmpMap);
|
||||
FieldMetaData.addStructMetaDataMap(BatchMutation.class, metaDataMap);
|
||||
}
|
||||
|
||||
@ -122,7 +129,7 @@ public class BatchMutation implements TBase<BatchMutation._Fields>, java.io.Seri
|
||||
}
|
||||
|
||||
public BatchMutation(
|
||||
byte[] row,
|
||||
ByteBuffer row,
|
||||
List<Mutation> mutations)
|
||||
{
|
||||
this();
|
||||
@ -150,16 +157,27 @@ public class BatchMutation implements TBase<BatchMutation._Fields>, java.io.Seri
|
||||
return new BatchMutation(this);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public BatchMutation clone() {
|
||||
return new BatchMutation(this);
|
||||
@Override
|
||||
public void clear() {
|
||||
this.row = null;
|
||||
this.mutations = null;
|
||||
}
|
||||
|
||||
public byte[] getRow() {
|
||||
return this.row;
|
||||
setRow(TBaseHelper.rightSize(row));
|
||||
return row.array();
|
||||
}
|
||||
|
||||
public ByteBuffer BufferForRow() {
|
||||
return row;
|
||||
}
|
||||
|
||||
public BatchMutation setRow(byte[] row) {
|
||||
setRow(ByteBuffer.wrap(row));
|
||||
return this;
|
||||
}
|
||||
|
||||
public BatchMutation setRow(ByteBuffer row) {
|
||||
this.row = row;
|
||||
return this;
|
||||
}
|
||||
@ -224,7 +242,7 @@ public class BatchMutation implements TBase<BatchMutation._Fields>, java.io.Seri
|
||||
if (value == null) {
|
||||
unsetRow();
|
||||
} else {
|
||||
setRow((byte[])value);
|
||||
setRow((ByteBuffer)value);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -239,10 +257,6 @@ public class BatchMutation implements TBase<BatchMutation._Fields>, java.io.Seri
|
||||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(int fieldID, Object value) {
|
||||
setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
|
||||
}
|
||||
|
||||
public Object getFieldValue(_Fields field) {
|
||||
switch (field) {
|
||||
case ROW:
|
||||
@ -255,12 +269,12 @@ public class BatchMutation implements TBase<BatchMutation._Fields>, java.io.Seri
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public Object getFieldValue(int fieldId) {
|
||||
return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
|
||||
}
|
||||
|
||||
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
|
||||
public boolean isSet(_Fields field) {
|
||||
if (field == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
switch (field) {
|
||||
case ROW:
|
||||
return isSetRow();
|
||||
@ -270,10 +284,6 @@ public class BatchMutation implements TBase<BatchMutation._Fields>, java.io.Seri
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public boolean isSet(int fieldID) {
|
||||
return isSet(_Fields.findByThriftIdOrThrow(fieldID));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that == null)
|
||||
@ -292,7 +302,7 @@ public class BatchMutation implements TBase<BatchMutation._Fields>, java.io.Seri
|
||||
if (this_present_row || that_present_row) {
|
||||
if (!(this_present_row && that_present_row))
|
||||
return false;
|
||||
if (!java.util.Arrays.equals(this.row, that.row))
|
||||
if (!this.row.equals(that.row))
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -310,19 +320,7 @@ public class BatchMutation implements TBase<BatchMutation._Fields>, java.io.Seri
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
HashCodeBuilder builder = new HashCodeBuilder();
|
||||
|
||||
boolean present_row = true && (isSetRow());
|
||||
builder.append(present_row);
|
||||
if (present_row)
|
||||
builder.append(row);
|
||||
|
||||
boolean present_mutations = true && (isSetMutations());
|
||||
builder.append(present_mutations);
|
||||
if (present_mutations)
|
||||
builder.append(mutations);
|
||||
|
||||
return builder.toHashCode();
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int compareTo(BatchMutation other) {
|
||||
@ -333,25 +331,33 @@ public class BatchMutation implements TBase<BatchMutation._Fields>, java.io.Seri
|
||||
int lastComparison = 0;
|
||||
BatchMutation typedOther = (BatchMutation)other;
|
||||
|
||||
lastComparison = Boolean.valueOf(isSetRow()).compareTo(isSetRow());
|
||||
lastComparison = Boolean.valueOf(isSetRow()).compareTo(typedOther.isSetRow());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
lastComparison = TBaseHelper.compareTo(row, typedOther.row);
|
||||
if (isSetRow()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.row, typedOther.row);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetMutations()).compareTo(typedOther.isSetMutations());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetMutations()).compareTo(isSetMutations());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
lastComparison = TBaseHelper.compareTo(mutations, typedOther.mutations);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
if (isSetMutations()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.mutations, typedOther.mutations);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public _Fields fieldForId(int fieldId) {
|
||||
return _Fields.findByThriftId(fieldId);
|
||||
}
|
||||
|
||||
public void read(TProtocol iprot) throws TException {
|
||||
TField field;
|
||||
iprot.readStructBegin();
|
||||
@ -361,39 +367,36 @@ public class BatchMutation implements TBase<BatchMutation._Fields>, java.io.Seri
|
||||
if (field.type == TType.STOP) {
|
||||
break;
|
||||
}
|
||||
_Fields fieldId = _Fields.findByThriftId(field.id);
|
||||
if (fieldId == null) {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
} else {
|
||||
switch (fieldId) {
|
||||
case ROW:
|
||||
if (field.type == TType.STRING) {
|
||||
this.row = iprot.readBinary();
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
case MUTATIONS:
|
||||
if (field.type == TType.LIST) {
|
||||
switch (field.id) {
|
||||
case 1: // ROW
|
||||
if (field.type == TType.STRING) {
|
||||
this.row = iprot.readBinary();
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
case 2: // MUTATIONS
|
||||
if (field.type == TType.LIST) {
|
||||
{
|
||||
TList _list0 = iprot.readListBegin();
|
||||
this.mutations = new ArrayList<Mutation>(_list0.size);
|
||||
for (int _i1 = 0; _i1 < _list0.size; ++_i1)
|
||||
{
|
||||
TList _list0 = iprot.readListBegin();
|
||||
this.mutations = new ArrayList<Mutation>(_list0.size);
|
||||
for (int _i1 = 0; _i1 < _list0.size; ++_i1)
|
||||
{
|
||||
Mutation _elem2;
|
||||
_elem2 = new Mutation();
|
||||
_elem2.read(iprot);
|
||||
this.mutations.add(_elem2);
|
||||
}
|
||||
iprot.readListEnd();
|
||||
Mutation _elem2;
|
||||
_elem2 = new Mutation();
|
||||
_elem2.read(iprot);
|
||||
this.mutations.add(_elem2);
|
||||
}
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
iprot.readListEnd();
|
||||
}
|
||||
break;
|
||||
}
|
||||
iprot.readFieldEnd();
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
iprot.readFieldEnd();
|
||||
}
|
||||
iprot.readStructEnd();
|
||||
|
||||
|
@ -17,7 +17,6 @@
|
||||
*/
|
||||
package org.apache.hadoop.hbase.thrift.generated;
|
||||
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
@ -28,12 +27,15 @@ import java.util.HashSet;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Collections;
|
||||
import java.util.BitSet;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Arrays;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.apache.thrift.*;
|
||||
import org.apache.thrift.async.*;
|
||||
import org.apache.thrift.meta_data.*;
|
||||
import org.apache.thrift.transport.*;
|
||||
import org.apache.thrift.protocol.*;
|
||||
|
||||
/**
|
||||
@ -41,7 +43,7 @@ import org.apache.thrift.protocol.*;
|
||||
* such as the number of versions, compression settings, etc. It is
|
||||
* used as input when creating a table or adding a column.
|
||||
*/
|
||||
public class ColumnDescriptor implements TBase<ColumnDescriptor._Fields>, java.io.Serializable, Cloneable, Comparable<ColumnDescriptor> {
|
||||
public class ColumnDescriptor implements TBase<ColumnDescriptor, ColumnDescriptor._Fields>, java.io.Serializable, Cloneable {
|
||||
private static final TStruct STRUCT_DESC = new TStruct("ColumnDescriptor");
|
||||
|
||||
private static final TField NAME_FIELD_DESC = new TField("name", TType.STRING, (short)1);
|
||||
@ -54,7 +56,7 @@ public class ColumnDescriptor implements TBase<ColumnDescriptor._Fields>, java.i
|
||||
private static final TField BLOCK_CACHE_ENABLED_FIELD_DESC = new TField("blockCacheEnabled", TType.BOOL, (short)8);
|
||||
private static final TField TIME_TO_LIVE_FIELD_DESC = new TField("timeToLive", TType.I32, (short)9);
|
||||
|
||||
public byte[] name;
|
||||
public ByteBuffer name;
|
||||
public int maxVersions;
|
||||
public String compression;
|
||||
public boolean inMemory;
|
||||
@ -76,12 +78,10 @@ public class ColumnDescriptor implements TBase<ColumnDescriptor._Fields>, java.i
|
||||
BLOCK_CACHE_ENABLED((short)8, "blockCacheEnabled"),
|
||||
TIME_TO_LIVE((short)9, "timeToLive");
|
||||
|
||||
private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
|
||||
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
|
||||
|
||||
static {
|
||||
for (_Fields field : EnumSet.allOf(_Fields.class)) {
|
||||
byId.put((int)field._thriftId, field);
|
||||
byName.put(field.getFieldName(), field);
|
||||
}
|
||||
}
|
||||
@ -90,7 +90,28 @@ public class ColumnDescriptor implements TBase<ColumnDescriptor._Fields>, java.i
|
||||
* Find the _Fields constant that matches fieldId, or null if its not found.
|
||||
*/
|
||||
public static _Fields findByThriftId(int fieldId) {
|
||||
return byId.get(fieldId);
|
||||
switch(fieldId) {
|
||||
case 1: // NAME
|
||||
return NAME;
|
||||
case 2: // MAX_VERSIONS
|
||||
return MAX_VERSIONS;
|
||||
case 3: // COMPRESSION
|
||||
return COMPRESSION;
|
||||
case 4: // IN_MEMORY
|
||||
return IN_MEMORY;
|
||||
case 5: // BLOOM_FILTER_TYPE
|
||||
return BLOOM_FILTER_TYPE;
|
||||
case 6: // BLOOM_FILTER_VECTOR_SIZE
|
||||
return BLOOM_FILTER_VECTOR_SIZE;
|
||||
case 7: // BLOOM_FILTER_NB_HASHES
|
||||
return BLOOM_FILTER_NB_HASHES;
|
||||
case 8: // BLOCK_CACHE_ENABLED
|
||||
return BLOCK_CACHE_ENABLED;
|
||||
case 9: // TIME_TO_LIVE
|
||||
return TIME_TO_LIVE;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -136,28 +157,28 @@ public class ColumnDescriptor implements TBase<ColumnDescriptor._Fields>, java.i
|
||||
private static final int __TIMETOLIVE_ISSET_ID = 5;
|
||||
private BitSet __isset_bit_vector = new BitSet(6);
|
||||
|
||||
public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
|
||||
put(_Fields.NAME, new FieldMetaData("name", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.STRING)));
|
||||
put(_Fields.MAX_VERSIONS, new FieldMetaData("maxVersions", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.I32)));
|
||||
put(_Fields.COMPRESSION, new FieldMetaData("compression", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.STRING)));
|
||||
put(_Fields.IN_MEMORY, new FieldMetaData("inMemory", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.BOOL)));
|
||||
put(_Fields.BLOOM_FILTER_TYPE, new FieldMetaData("bloomFilterType", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.STRING)));
|
||||
put(_Fields.BLOOM_FILTER_VECTOR_SIZE, new FieldMetaData("bloomFilterVectorSize", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.I32)));
|
||||
put(_Fields.BLOOM_FILTER_NB_HASHES, new FieldMetaData("bloomFilterNbHashes", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.I32)));
|
||||
put(_Fields.BLOCK_CACHE_ENABLED, new FieldMetaData("blockCacheEnabled", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.BOOL)));
|
||||
put(_Fields.TIME_TO_LIVE, new FieldMetaData("timeToLive", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.I32)));
|
||||
}});
|
||||
|
||||
public static final Map<_Fields, FieldMetaData> metaDataMap;
|
||||
static {
|
||||
Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class);
|
||||
tmpMap.put(_Fields.NAME, new FieldMetaData("name", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.STRING , "Text")));
|
||||
tmpMap.put(_Fields.MAX_VERSIONS, new FieldMetaData("maxVersions", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.I32)));
|
||||
tmpMap.put(_Fields.COMPRESSION, new FieldMetaData("compression", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.STRING)));
|
||||
tmpMap.put(_Fields.IN_MEMORY, new FieldMetaData("inMemory", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.BOOL)));
|
||||
tmpMap.put(_Fields.BLOOM_FILTER_TYPE, new FieldMetaData("bloomFilterType", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.STRING)));
|
||||
tmpMap.put(_Fields.BLOOM_FILTER_VECTOR_SIZE, new FieldMetaData("bloomFilterVectorSize", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.I32)));
|
||||
tmpMap.put(_Fields.BLOOM_FILTER_NB_HASHES, new FieldMetaData("bloomFilterNbHashes", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.I32)));
|
||||
tmpMap.put(_Fields.BLOCK_CACHE_ENABLED, new FieldMetaData("blockCacheEnabled", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.BOOL)));
|
||||
tmpMap.put(_Fields.TIME_TO_LIVE, new FieldMetaData("timeToLive", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.I32)));
|
||||
metaDataMap = Collections.unmodifiableMap(tmpMap);
|
||||
FieldMetaData.addStructMetaDataMap(ColumnDescriptor.class, metaDataMap);
|
||||
}
|
||||
|
||||
@ -181,7 +202,7 @@ public class ColumnDescriptor implements TBase<ColumnDescriptor._Fields>, java.i
|
||||
}
|
||||
|
||||
public ColumnDescriptor(
|
||||
byte[] name,
|
||||
ByteBuffer name,
|
||||
int maxVersions,
|
||||
String compression,
|
||||
boolean inMemory,
|
||||
@ -236,16 +257,42 @@ public class ColumnDescriptor implements TBase<ColumnDescriptor._Fields>, java.i
|
||||
return new ColumnDescriptor(this);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public ColumnDescriptor clone() {
|
||||
return new ColumnDescriptor(this);
|
||||
@Override
|
||||
public void clear() {
|
||||
this.name = null;
|
||||
this.maxVersions = 3;
|
||||
|
||||
this.compression = "NONE";
|
||||
|
||||
this.inMemory = false;
|
||||
|
||||
this.bloomFilterType = "NONE";
|
||||
|
||||
this.bloomFilterVectorSize = 0;
|
||||
|
||||
this.bloomFilterNbHashes = 0;
|
||||
|
||||
this.blockCacheEnabled = false;
|
||||
|
||||
this.timeToLive = -1;
|
||||
|
||||
}
|
||||
|
||||
public byte[] getName() {
|
||||
return this.name;
|
||||
setName(TBaseHelper.rightSize(name));
|
||||
return name.array();
|
||||
}
|
||||
|
||||
public ByteBuffer BufferForName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public ColumnDescriptor setName(byte[] name) {
|
||||
setName(ByteBuffer.wrap(name));
|
||||
return this;
|
||||
}
|
||||
|
||||
public ColumnDescriptor setName(ByteBuffer name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
@ -457,7 +504,7 @@ public class ColumnDescriptor implements TBase<ColumnDescriptor._Fields>, java.i
|
||||
if (value == null) {
|
||||
unsetName();
|
||||
} else {
|
||||
setName((byte[])value);
|
||||
setName((ByteBuffer)value);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -528,10 +575,6 @@ public class ColumnDescriptor implements TBase<ColumnDescriptor._Fields>, java.i
|
||||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(int fieldID, Object value) {
|
||||
setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
|
||||
}
|
||||
|
||||
public Object getFieldValue(_Fields field) {
|
||||
switch (field) {
|
||||
case NAME:
|
||||
@ -565,12 +608,12 @@ public class ColumnDescriptor implements TBase<ColumnDescriptor._Fields>, java.i
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public Object getFieldValue(int fieldId) {
|
||||
return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
|
||||
}
|
||||
|
||||
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
|
||||
public boolean isSet(_Fields field) {
|
||||
if (field == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
switch (field) {
|
||||
case NAME:
|
||||
return isSetName();
|
||||
@ -594,10 +637,6 @@ public class ColumnDescriptor implements TBase<ColumnDescriptor._Fields>, java.i
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public boolean isSet(int fieldID) {
|
||||
return isSet(_Fields.findByThriftIdOrThrow(fieldID));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that == null)
|
||||
@ -616,7 +655,7 @@ public class ColumnDescriptor implements TBase<ColumnDescriptor._Fields>, java.i
|
||||
if (this_present_name || that_present_name) {
|
||||
if (!(this_present_name && that_present_name))
|
||||
return false;
|
||||
if (!java.util.Arrays.equals(this.name, that.name))
|
||||
if (!this.name.equals(that.name))
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -697,54 +736,7 @@ public class ColumnDescriptor implements TBase<ColumnDescriptor._Fields>, java.i
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
HashCodeBuilder builder = new HashCodeBuilder();
|
||||
|
||||
boolean present_name = true && (isSetName());
|
||||
builder.append(present_name);
|
||||
if (present_name)
|
||||
builder.append(name);
|
||||
|
||||
boolean present_maxVersions = true;
|
||||
builder.append(present_maxVersions);
|
||||
if (present_maxVersions)
|
||||
builder.append(maxVersions);
|
||||
|
||||
boolean present_compression = true && (isSetCompression());
|
||||
builder.append(present_compression);
|
||||
if (present_compression)
|
||||
builder.append(compression);
|
||||
|
||||
boolean present_inMemory = true;
|
||||
builder.append(present_inMemory);
|
||||
if (present_inMemory)
|
||||
builder.append(inMemory);
|
||||
|
||||
boolean present_bloomFilterType = true && (isSetBloomFilterType());
|
||||
builder.append(present_bloomFilterType);
|
||||
if (present_bloomFilterType)
|
||||
builder.append(bloomFilterType);
|
||||
|
||||
boolean present_bloomFilterVectorSize = true;
|
||||
builder.append(present_bloomFilterVectorSize);
|
||||
if (present_bloomFilterVectorSize)
|
||||
builder.append(bloomFilterVectorSize);
|
||||
|
||||
boolean present_bloomFilterNbHashes = true;
|
||||
builder.append(present_bloomFilterNbHashes);
|
||||
if (present_bloomFilterNbHashes)
|
||||
builder.append(bloomFilterNbHashes);
|
||||
|
||||
boolean present_blockCacheEnabled = true;
|
||||
builder.append(present_blockCacheEnabled);
|
||||
if (present_blockCacheEnabled)
|
||||
builder.append(blockCacheEnabled);
|
||||
|
||||
boolean present_timeToLive = true;
|
||||
builder.append(present_timeToLive);
|
||||
if (present_timeToLive)
|
||||
builder.append(timeToLive);
|
||||
|
||||
return builder.toHashCode();
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int compareTo(ColumnDescriptor other) {
|
||||
@ -755,81 +747,103 @@ public class ColumnDescriptor implements TBase<ColumnDescriptor._Fields>, java.i
|
||||
int lastComparison = 0;
|
||||
ColumnDescriptor typedOther = (ColumnDescriptor)other;
|
||||
|
||||
lastComparison = Boolean.valueOf(isSetName()).compareTo(isSetName());
|
||||
lastComparison = Boolean.valueOf(isSetName()).compareTo(typedOther.isSetName());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
lastComparison = TBaseHelper.compareTo(name, typedOther.name);
|
||||
if (isSetName()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.name, typedOther.name);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetMaxVersions()).compareTo(typedOther.isSetMaxVersions());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetMaxVersions()).compareTo(isSetMaxVersions());
|
||||
if (isSetMaxVersions()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.maxVersions, typedOther.maxVersions);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetCompression()).compareTo(typedOther.isSetCompression());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
lastComparison = TBaseHelper.compareTo(maxVersions, typedOther.maxVersions);
|
||||
if (isSetCompression()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.compression, typedOther.compression);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetInMemory()).compareTo(typedOther.isSetInMemory());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetCompression()).compareTo(isSetCompression());
|
||||
if (isSetInMemory()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.inMemory, typedOther.inMemory);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetBloomFilterType()).compareTo(typedOther.isSetBloomFilterType());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
lastComparison = TBaseHelper.compareTo(compression, typedOther.compression);
|
||||
if (isSetBloomFilterType()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.bloomFilterType, typedOther.bloomFilterType);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetBloomFilterVectorSize()).compareTo(typedOther.isSetBloomFilterVectorSize());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetInMemory()).compareTo(isSetInMemory());
|
||||
if (isSetBloomFilterVectorSize()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.bloomFilterVectorSize, typedOther.bloomFilterVectorSize);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetBloomFilterNbHashes()).compareTo(typedOther.isSetBloomFilterNbHashes());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
lastComparison = TBaseHelper.compareTo(inMemory, typedOther.inMemory);
|
||||
if (isSetBloomFilterNbHashes()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.bloomFilterNbHashes, typedOther.bloomFilterNbHashes);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetBlockCacheEnabled()).compareTo(typedOther.isSetBlockCacheEnabled());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetBloomFilterType()).compareTo(isSetBloomFilterType());
|
||||
if (isSetBlockCacheEnabled()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.blockCacheEnabled, typedOther.blockCacheEnabled);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetTimeToLive()).compareTo(typedOther.isSetTimeToLive());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
lastComparison = TBaseHelper.compareTo(bloomFilterType, typedOther.bloomFilterType);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetBloomFilterVectorSize()).compareTo(isSetBloomFilterVectorSize());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
lastComparison = TBaseHelper.compareTo(bloomFilterVectorSize, typedOther.bloomFilterVectorSize);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetBloomFilterNbHashes()).compareTo(isSetBloomFilterNbHashes());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
lastComparison = TBaseHelper.compareTo(bloomFilterNbHashes, typedOther.bloomFilterNbHashes);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetBlockCacheEnabled()).compareTo(isSetBlockCacheEnabled());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
lastComparison = TBaseHelper.compareTo(blockCacheEnabled, typedOther.blockCacheEnabled);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetTimeToLive()).compareTo(isSetTimeToLive());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
lastComparison = TBaseHelper.compareTo(timeToLive, typedOther.timeToLive);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
if (isSetTimeToLive()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.timeToLive, typedOther.timeToLive);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public _Fields fieldForId(int fieldId) {
|
||||
return _Fields.findByThriftId(fieldId);
|
||||
}
|
||||
|
||||
public void read(TProtocol iprot) throws TException {
|
||||
TField field;
|
||||
iprot.readStructBegin();
|
||||
@ -839,83 +853,80 @@ public class ColumnDescriptor implements TBase<ColumnDescriptor._Fields>, java.i
|
||||
if (field.type == TType.STOP) {
|
||||
break;
|
||||
}
|
||||
_Fields fieldId = _Fields.findByThriftId(field.id);
|
||||
if (fieldId == null) {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
} else {
|
||||
switch (fieldId) {
|
||||
case NAME:
|
||||
if (field.type == TType.STRING) {
|
||||
this.name = iprot.readBinary();
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
case MAX_VERSIONS:
|
||||
if (field.type == TType.I32) {
|
||||
this.maxVersions = iprot.readI32();
|
||||
setMaxVersionsIsSet(true);
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
case COMPRESSION:
|
||||
if (field.type == TType.STRING) {
|
||||
this.compression = iprot.readString();
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
case IN_MEMORY:
|
||||
if (field.type == TType.BOOL) {
|
||||
this.inMemory = iprot.readBool();
|
||||
setInMemoryIsSet(true);
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
case BLOOM_FILTER_TYPE:
|
||||
if (field.type == TType.STRING) {
|
||||
this.bloomFilterType = iprot.readString();
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
case BLOOM_FILTER_VECTOR_SIZE:
|
||||
if (field.type == TType.I32) {
|
||||
this.bloomFilterVectorSize = iprot.readI32();
|
||||
setBloomFilterVectorSizeIsSet(true);
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
case BLOOM_FILTER_NB_HASHES:
|
||||
if (field.type == TType.I32) {
|
||||
this.bloomFilterNbHashes = iprot.readI32();
|
||||
setBloomFilterNbHashesIsSet(true);
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
case BLOCK_CACHE_ENABLED:
|
||||
if (field.type == TType.BOOL) {
|
||||
this.blockCacheEnabled = iprot.readBool();
|
||||
setBlockCacheEnabledIsSet(true);
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
case TIME_TO_LIVE:
|
||||
if (field.type == TType.I32) {
|
||||
this.timeToLive = iprot.readI32();
|
||||
setTimeToLiveIsSet(true);
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
}
|
||||
iprot.readFieldEnd();
|
||||
switch (field.id) {
|
||||
case 1: // NAME
|
||||
if (field.type == TType.STRING) {
|
||||
this.name = iprot.readBinary();
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
case 2: // MAX_VERSIONS
|
||||
if (field.type == TType.I32) {
|
||||
this.maxVersions = iprot.readI32();
|
||||
setMaxVersionsIsSet(true);
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
case 3: // COMPRESSION
|
||||
if (field.type == TType.STRING) {
|
||||
this.compression = iprot.readString();
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
case 4: // IN_MEMORY
|
||||
if (field.type == TType.BOOL) {
|
||||
this.inMemory = iprot.readBool();
|
||||
setInMemoryIsSet(true);
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
case 5: // BLOOM_FILTER_TYPE
|
||||
if (field.type == TType.STRING) {
|
||||
this.bloomFilterType = iprot.readString();
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
case 6: // BLOOM_FILTER_VECTOR_SIZE
|
||||
if (field.type == TType.I32) {
|
||||
this.bloomFilterVectorSize = iprot.readI32();
|
||||
setBloomFilterVectorSizeIsSet(true);
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
case 7: // BLOOM_FILTER_NB_HASHES
|
||||
if (field.type == TType.I32) {
|
||||
this.bloomFilterNbHashes = iprot.readI32();
|
||||
setBloomFilterNbHashesIsSet(true);
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
case 8: // BLOCK_CACHE_ENABLED
|
||||
if (field.type == TType.BOOL) {
|
||||
this.blockCacheEnabled = iprot.readBool();
|
||||
setBlockCacheEnabledIsSet(true);
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
case 9: // TIME_TO_LIVE
|
||||
if (field.type == TType.I32) {
|
||||
this.timeToLive = iprot.readI32();
|
||||
setTimeToLiveIsSet(true);
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
iprot.readFieldEnd();
|
||||
}
|
||||
iprot.readStructEnd();
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -17,7 +17,6 @@
|
||||
*/
|
||||
package org.apache.hadoop.hbase.thrift.generated;
|
||||
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
@ -28,12 +27,15 @@ import java.util.HashSet;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Collections;
|
||||
import java.util.BitSet;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Arrays;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.apache.thrift.*;
|
||||
import org.apache.thrift.async.*;
|
||||
import org.apache.thrift.meta_data.*;
|
||||
import org.apache.thrift.transport.*;
|
||||
import org.apache.thrift.protocol.*;
|
||||
|
||||
/**
|
||||
@ -41,7 +43,7 @@ import org.apache.thrift.protocol.*;
|
||||
* to the Hbase master or an Hbase region server. Also used to return
|
||||
* more general Hbase error conditions.
|
||||
*/
|
||||
public class IOError extends Exception implements TBase<IOError._Fields>, java.io.Serializable, Cloneable, Comparable<IOError> {
|
||||
public class IOError extends Exception implements TBase<IOError, IOError._Fields>, java.io.Serializable, Cloneable {
|
||||
private static final TStruct STRUCT_DESC = new TStruct("IOError");
|
||||
|
||||
private static final TField MESSAGE_FIELD_DESC = new TField("message", TType.STRING, (short)1);
|
||||
@ -52,12 +54,10 @@ public class IOError extends Exception implements TBase<IOError._Fields>, java.i
|
||||
public enum _Fields implements TFieldIdEnum {
|
||||
MESSAGE((short)1, "message");
|
||||
|
||||
private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
|
||||
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
|
||||
|
||||
static {
|
||||
for (_Fields field : EnumSet.allOf(_Fields.class)) {
|
||||
byId.put((int)field._thriftId, field);
|
||||
byName.put(field.getFieldName(), field);
|
||||
}
|
||||
}
|
||||
@ -66,7 +66,12 @@ public class IOError extends Exception implements TBase<IOError._Fields>, java.i
|
||||
* Find the _Fields constant that matches fieldId, or null if its not found.
|
||||
*/
|
||||
public static _Fields findByThriftId(int fieldId) {
|
||||
return byId.get(fieldId);
|
||||
switch(fieldId) {
|
||||
case 1: // MESSAGE
|
||||
return MESSAGE;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -105,12 +110,12 @@ public class IOError extends Exception implements TBase<IOError._Fields>, java.i
|
||||
|
||||
// isset id assignments
|
||||
|
||||
public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
|
||||
put(_Fields.MESSAGE, new FieldMetaData("message", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.STRING)));
|
||||
}});
|
||||
|
||||
public static final Map<_Fields, FieldMetaData> metaDataMap;
|
||||
static {
|
||||
Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class);
|
||||
tmpMap.put(_Fields.MESSAGE, new FieldMetaData("message", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.STRING)));
|
||||
metaDataMap = Collections.unmodifiableMap(tmpMap);
|
||||
FieldMetaData.addStructMetaDataMap(IOError.class, metaDataMap);
|
||||
}
|
||||
|
||||
@ -137,9 +142,9 @@ public class IOError extends Exception implements TBase<IOError._Fields>, java.i
|
||||
return new IOError(this);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public IOError clone() {
|
||||
return new IOError(this);
|
||||
@Override
|
||||
public void clear() {
|
||||
this.message = null;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
@ -179,10 +184,6 @@ public class IOError extends Exception implements TBase<IOError._Fields>, java.i
|
||||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(int fieldID, Object value) {
|
||||
setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
|
||||
}
|
||||
|
||||
public Object getFieldValue(_Fields field) {
|
||||
switch (field) {
|
||||
case MESSAGE:
|
||||
@ -192,12 +193,12 @@ public class IOError extends Exception implements TBase<IOError._Fields>, java.i
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public Object getFieldValue(int fieldId) {
|
||||
return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
|
||||
}
|
||||
|
||||
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
|
||||
public boolean isSet(_Fields field) {
|
||||
if (field == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
switch (field) {
|
||||
case MESSAGE:
|
||||
return isSetMessage();
|
||||
@ -205,10 +206,6 @@ public class IOError extends Exception implements TBase<IOError._Fields>, java.i
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public boolean isSet(int fieldID) {
|
||||
return isSet(_Fields.findByThriftIdOrThrow(fieldID));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that == null)
|
||||
@ -236,14 +233,7 @@ public class IOError extends Exception implements TBase<IOError._Fields>, java.i
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
HashCodeBuilder builder = new HashCodeBuilder();
|
||||
|
||||
boolean present_message = true && (isSetMessage());
|
||||
builder.append(present_message);
|
||||
if (present_message)
|
||||
builder.append(message);
|
||||
|
||||
return builder.toHashCode();
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int compareTo(IOError other) {
|
||||
@ -254,17 +244,23 @@ public class IOError extends Exception implements TBase<IOError._Fields>, java.i
|
||||
int lastComparison = 0;
|
||||
IOError typedOther = (IOError)other;
|
||||
|
||||
lastComparison = Boolean.valueOf(isSetMessage()).compareTo(isSetMessage());
|
||||
lastComparison = Boolean.valueOf(isSetMessage()).compareTo(typedOther.isSetMessage());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
lastComparison = TBaseHelper.compareTo(message, typedOther.message);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
if (isSetMessage()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.message, typedOther.message);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public _Fields fieldForId(int fieldId) {
|
||||
return _Fields.findByThriftId(fieldId);
|
||||
}
|
||||
|
||||
public void read(TProtocol iprot) throws TException {
|
||||
TField field;
|
||||
iprot.readStructBegin();
|
||||
@ -274,21 +270,18 @@ public class IOError extends Exception implements TBase<IOError._Fields>, java.i
|
||||
if (field.type == TType.STOP) {
|
||||
break;
|
||||
}
|
||||
_Fields fieldId = _Fields.findByThriftId(field.id);
|
||||
if (fieldId == null) {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
} else {
|
||||
switch (fieldId) {
|
||||
case MESSAGE:
|
||||
if (field.type == TType.STRING) {
|
||||
this.message = iprot.readString();
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
}
|
||||
iprot.readFieldEnd();
|
||||
switch (field.id) {
|
||||
case 1: // MESSAGE
|
||||
if (field.type == TType.STRING) {
|
||||
this.message = iprot.readString();
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
iprot.readFieldEnd();
|
||||
}
|
||||
iprot.readStructEnd();
|
||||
|
||||
|
@ -17,7 +17,6 @@
|
||||
*/
|
||||
package org.apache.hadoop.hbase.thrift.generated;
|
||||
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
@ -28,19 +27,22 @@ import java.util.HashSet;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Collections;
|
||||
import java.util.BitSet;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Arrays;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.apache.thrift.*;
|
||||
import org.apache.thrift.async.*;
|
||||
import org.apache.thrift.meta_data.*;
|
||||
import org.apache.thrift.transport.*;
|
||||
import org.apache.thrift.protocol.*;
|
||||
|
||||
/**
|
||||
* An IllegalArgument exception indicates an illegal or invalid
|
||||
* argument was passed into a procedure.
|
||||
*/
|
||||
public class IllegalArgument extends Exception implements TBase<IllegalArgument._Fields>, java.io.Serializable, Cloneable, Comparable<IllegalArgument> {
|
||||
public class IllegalArgument extends Exception implements TBase<IllegalArgument, IllegalArgument._Fields>, java.io.Serializable, Cloneable {
|
||||
private static final TStruct STRUCT_DESC = new TStruct("IllegalArgument");
|
||||
|
||||
private static final TField MESSAGE_FIELD_DESC = new TField("message", TType.STRING, (short)1);
|
||||
@ -51,12 +53,10 @@ public class IllegalArgument extends Exception implements TBase<IllegalArgument.
|
||||
public enum _Fields implements TFieldIdEnum {
|
||||
MESSAGE((short)1, "message");
|
||||
|
||||
private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
|
||||
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
|
||||
|
||||
static {
|
||||
for (_Fields field : EnumSet.allOf(_Fields.class)) {
|
||||
byId.put((int)field._thriftId, field);
|
||||
byName.put(field.getFieldName(), field);
|
||||
}
|
||||
}
|
||||
@ -65,7 +65,12 @@ public class IllegalArgument extends Exception implements TBase<IllegalArgument.
|
||||
* Find the _Fields constant that matches fieldId, or null if its not found.
|
||||
*/
|
||||
public static _Fields findByThriftId(int fieldId) {
|
||||
return byId.get(fieldId);
|
||||
switch(fieldId) {
|
||||
case 1: // MESSAGE
|
||||
return MESSAGE;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -104,12 +109,12 @@ public class IllegalArgument extends Exception implements TBase<IllegalArgument.
|
||||
|
||||
// isset id assignments
|
||||
|
||||
public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
|
||||
put(_Fields.MESSAGE, new FieldMetaData("message", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.STRING)));
|
||||
}});
|
||||
|
||||
public static final Map<_Fields, FieldMetaData> metaDataMap;
|
||||
static {
|
||||
Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class);
|
||||
tmpMap.put(_Fields.MESSAGE, new FieldMetaData("message", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.STRING)));
|
||||
metaDataMap = Collections.unmodifiableMap(tmpMap);
|
||||
FieldMetaData.addStructMetaDataMap(IllegalArgument.class, metaDataMap);
|
||||
}
|
||||
|
||||
@ -136,9 +141,9 @@ public class IllegalArgument extends Exception implements TBase<IllegalArgument.
|
||||
return new IllegalArgument(this);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public IllegalArgument clone() {
|
||||
return new IllegalArgument(this);
|
||||
@Override
|
||||
public void clear() {
|
||||
this.message = null;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
@ -178,10 +183,6 @@ public class IllegalArgument extends Exception implements TBase<IllegalArgument.
|
||||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(int fieldID, Object value) {
|
||||
setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
|
||||
}
|
||||
|
||||
public Object getFieldValue(_Fields field) {
|
||||
switch (field) {
|
||||
case MESSAGE:
|
||||
@ -191,12 +192,12 @@ public class IllegalArgument extends Exception implements TBase<IllegalArgument.
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public Object getFieldValue(int fieldId) {
|
||||
return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
|
||||
}
|
||||
|
||||
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
|
||||
public boolean isSet(_Fields field) {
|
||||
if (field == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
switch (field) {
|
||||
case MESSAGE:
|
||||
return isSetMessage();
|
||||
@ -204,10 +205,6 @@ public class IllegalArgument extends Exception implements TBase<IllegalArgument.
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public boolean isSet(int fieldID) {
|
||||
return isSet(_Fields.findByThriftIdOrThrow(fieldID));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that == null)
|
||||
@ -235,14 +232,7 @@ public class IllegalArgument extends Exception implements TBase<IllegalArgument.
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
HashCodeBuilder builder = new HashCodeBuilder();
|
||||
|
||||
boolean present_message = true && (isSetMessage());
|
||||
builder.append(present_message);
|
||||
if (present_message)
|
||||
builder.append(message);
|
||||
|
||||
return builder.toHashCode();
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int compareTo(IllegalArgument other) {
|
||||
@ -253,17 +243,23 @@ public class IllegalArgument extends Exception implements TBase<IllegalArgument.
|
||||
int lastComparison = 0;
|
||||
IllegalArgument typedOther = (IllegalArgument)other;
|
||||
|
||||
lastComparison = Boolean.valueOf(isSetMessage()).compareTo(isSetMessage());
|
||||
lastComparison = Boolean.valueOf(isSetMessage()).compareTo(typedOther.isSetMessage());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
lastComparison = TBaseHelper.compareTo(message, typedOther.message);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
if (isSetMessage()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.message, typedOther.message);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public _Fields fieldForId(int fieldId) {
|
||||
return _Fields.findByThriftId(fieldId);
|
||||
}
|
||||
|
||||
public void read(TProtocol iprot) throws TException {
|
||||
TField field;
|
||||
iprot.readStructBegin();
|
||||
@ -273,21 +269,18 @@ public class IllegalArgument extends Exception implements TBase<IllegalArgument.
|
||||
if (field.type == TType.STOP) {
|
||||
break;
|
||||
}
|
||||
_Fields fieldId = _Fields.findByThriftId(field.id);
|
||||
if (fieldId == null) {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
} else {
|
||||
switch (fieldId) {
|
||||
case MESSAGE:
|
||||
if (field.type == TType.STRING) {
|
||||
this.message = iprot.readString();
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
}
|
||||
iprot.readFieldEnd();
|
||||
switch (field.id) {
|
||||
case 1: // MESSAGE
|
||||
if (field.type == TType.STRING) {
|
||||
this.message = iprot.readString();
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
iprot.readFieldEnd();
|
||||
}
|
||||
iprot.readStructEnd();
|
||||
|
||||
|
@ -17,7 +17,6 @@
|
||||
*/
|
||||
package org.apache.hadoop.hbase.thrift.generated;
|
||||
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
@ -28,18 +27,21 @@ import java.util.HashSet;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Collections;
|
||||
import java.util.BitSet;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Arrays;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.apache.thrift.*;
|
||||
import org.apache.thrift.async.*;
|
||||
import org.apache.thrift.meta_data.*;
|
||||
import org.apache.thrift.transport.*;
|
||||
import org.apache.thrift.protocol.*;
|
||||
|
||||
/**
|
||||
* A Mutation object is used to either update or delete a column-value.
|
||||
*/
|
||||
public class Mutation implements TBase<Mutation._Fields>, java.io.Serializable, Cloneable, Comparable<Mutation> {
|
||||
public class Mutation implements TBase<Mutation, Mutation._Fields>, java.io.Serializable, Cloneable {
|
||||
private static final TStruct STRUCT_DESC = new TStruct("Mutation");
|
||||
|
||||
private static final TField IS_DELETE_FIELD_DESC = new TField("isDelete", TType.BOOL, (short)1);
|
||||
@ -47,8 +49,8 @@ public class Mutation implements TBase<Mutation._Fields>, java.io.Serializable,
|
||||
private static final TField VALUE_FIELD_DESC = new TField("value", TType.STRING, (short)3);
|
||||
|
||||
public boolean isDelete;
|
||||
public byte[] column;
|
||||
public byte[] value;
|
||||
public ByteBuffer column;
|
||||
public ByteBuffer value;
|
||||
|
||||
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
|
||||
public enum _Fields implements TFieldIdEnum {
|
||||
@ -56,12 +58,10 @@ public class Mutation implements TBase<Mutation._Fields>, java.io.Serializable,
|
||||
COLUMN((short)2, "column"),
|
||||
VALUE((short)3, "value");
|
||||
|
||||
private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
|
||||
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
|
||||
|
||||
static {
|
||||
for (_Fields field : EnumSet.allOf(_Fields.class)) {
|
||||
byId.put((int)field._thriftId, field);
|
||||
byName.put(field.getFieldName(), field);
|
||||
}
|
||||
}
|
||||
@ -70,7 +70,16 @@ public class Mutation implements TBase<Mutation._Fields>, java.io.Serializable,
|
||||
* Find the _Fields constant that matches fieldId, or null if its not found.
|
||||
*/
|
||||
public static _Fields findByThriftId(int fieldId) {
|
||||
return byId.get(fieldId);
|
||||
switch(fieldId) {
|
||||
case 1: // IS_DELETE
|
||||
return IS_DELETE;
|
||||
case 2: // COLUMN
|
||||
return COLUMN;
|
||||
case 3: // VALUE
|
||||
return VALUE;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -111,16 +120,16 @@ public class Mutation implements TBase<Mutation._Fields>, java.io.Serializable,
|
||||
private static final int __ISDELETE_ISSET_ID = 0;
|
||||
private BitSet __isset_bit_vector = new BitSet(1);
|
||||
|
||||
public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
|
||||
put(_Fields.IS_DELETE, new FieldMetaData("isDelete", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.BOOL)));
|
||||
put(_Fields.COLUMN, new FieldMetaData("column", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.STRING)));
|
||||
put(_Fields.VALUE, new FieldMetaData("value", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.STRING)));
|
||||
}});
|
||||
|
||||
public static final Map<_Fields, FieldMetaData> metaDataMap;
|
||||
static {
|
||||
Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class);
|
||||
tmpMap.put(_Fields.IS_DELETE, new FieldMetaData("isDelete", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.BOOL)));
|
||||
tmpMap.put(_Fields.COLUMN, new FieldMetaData("column", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.STRING , "Text")));
|
||||
tmpMap.put(_Fields.VALUE, new FieldMetaData("value", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.STRING , "Text")));
|
||||
metaDataMap = Collections.unmodifiableMap(tmpMap);
|
||||
FieldMetaData.addStructMetaDataMap(Mutation.class, metaDataMap);
|
||||
}
|
||||
|
||||
@ -131,8 +140,8 @@ public class Mutation implements TBase<Mutation._Fields>, java.io.Serializable,
|
||||
|
||||
public Mutation(
|
||||
boolean isDelete,
|
||||
byte[] column,
|
||||
byte[] value)
|
||||
ByteBuffer column,
|
||||
ByteBuffer value)
|
||||
{
|
||||
this();
|
||||
this.isDelete = isDelete;
|
||||
@ -160,9 +169,12 @@ public class Mutation implements TBase<Mutation._Fields>, java.io.Serializable,
|
||||
return new Mutation(this);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public Mutation clone() {
|
||||
return new Mutation(this);
|
||||
@Override
|
||||
public void clear() {
|
||||
this.isDelete = false;
|
||||
|
||||
this.column = null;
|
||||
this.value = null;
|
||||
}
|
||||
|
||||
public boolean isIsDelete() {
|
||||
@ -189,10 +201,20 @@ public class Mutation implements TBase<Mutation._Fields>, java.io.Serializable,
|
||||
}
|
||||
|
||||
public byte[] getColumn() {
|
||||
return this.column;
|
||||
setColumn(TBaseHelper.rightSize(column));
|
||||
return column.array();
|
||||
}
|
||||
|
||||
public ByteBuffer BufferForColumn() {
|
||||
return column;
|
||||
}
|
||||
|
||||
public Mutation setColumn(byte[] column) {
|
||||
setColumn(ByteBuffer.wrap(column));
|
||||
return this;
|
||||
}
|
||||
|
||||
public Mutation setColumn(ByteBuffer column) {
|
||||
this.column = column;
|
||||
return this;
|
||||
}
|
||||
@ -213,10 +235,20 @@ public class Mutation implements TBase<Mutation._Fields>, java.io.Serializable,
|
||||
}
|
||||
|
||||
public byte[] getValue() {
|
||||
return this.value;
|
||||
setValue(TBaseHelper.rightSize(value));
|
||||
return value.array();
|
||||
}
|
||||
|
||||
public ByteBuffer BufferForValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public Mutation setValue(byte[] value) {
|
||||
setValue(ByteBuffer.wrap(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
public Mutation setValue(ByteBuffer value) {
|
||||
this.value = value;
|
||||
return this;
|
||||
}
|
||||
@ -250,7 +282,7 @@ public class Mutation implements TBase<Mutation._Fields>, java.io.Serializable,
|
||||
if (value == null) {
|
||||
unsetColumn();
|
||||
} else {
|
||||
setColumn((byte[])value);
|
||||
setColumn((ByteBuffer)value);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -258,17 +290,13 @@ public class Mutation implements TBase<Mutation._Fields>, java.io.Serializable,
|
||||
if (value == null) {
|
||||
unsetValue();
|
||||
} else {
|
||||
setValue((byte[])value);
|
||||
setValue((ByteBuffer)value);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(int fieldID, Object value) {
|
||||
setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
|
||||
}
|
||||
|
||||
public Object getFieldValue(_Fields field) {
|
||||
switch (field) {
|
||||
case IS_DELETE:
|
||||
@ -284,12 +312,12 @@ public class Mutation implements TBase<Mutation._Fields>, java.io.Serializable,
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public Object getFieldValue(int fieldId) {
|
||||
return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
|
||||
}
|
||||
|
||||
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
|
||||
public boolean isSet(_Fields field) {
|
||||
if (field == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
switch (field) {
|
||||
case IS_DELETE:
|
||||
return isSetIsDelete();
|
||||
@ -301,10 +329,6 @@ public class Mutation implements TBase<Mutation._Fields>, java.io.Serializable,
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public boolean isSet(int fieldID) {
|
||||
return isSet(_Fields.findByThriftIdOrThrow(fieldID));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that == null)
|
||||
@ -332,7 +356,7 @@ public class Mutation implements TBase<Mutation._Fields>, java.io.Serializable,
|
||||
if (this_present_column || that_present_column) {
|
||||
if (!(this_present_column && that_present_column))
|
||||
return false;
|
||||
if (!java.util.Arrays.equals(this.column, that.column))
|
||||
if (!this.column.equals(that.column))
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -341,7 +365,7 @@ public class Mutation implements TBase<Mutation._Fields>, java.io.Serializable,
|
||||
if (this_present_value || that_present_value) {
|
||||
if (!(this_present_value && that_present_value))
|
||||
return false;
|
||||
if (!java.util.Arrays.equals(this.value, that.value))
|
||||
if (!this.value.equals(that.value))
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -350,24 +374,7 @@ public class Mutation implements TBase<Mutation._Fields>, java.io.Serializable,
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
HashCodeBuilder builder = new HashCodeBuilder();
|
||||
|
||||
boolean present_isDelete = true;
|
||||
builder.append(present_isDelete);
|
||||
if (present_isDelete)
|
||||
builder.append(isDelete);
|
||||
|
||||
boolean present_column = true && (isSetColumn());
|
||||
builder.append(present_column);
|
||||
if (present_column)
|
||||
builder.append(column);
|
||||
|
||||
boolean present_value = true && (isSetValue());
|
||||
builder.append(present_value);
|
||||
if (present_value)
|
||||
builder.append(value);
|
||||
|
||||
return builder.toHashCode();
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int compareTo(Mutation other) {
|
||||
@ -378,33 +385,43 @@ public class Mutation implements TBase<Mutation._Fields>, java.io.Serializable,
|
||||
int lastComparison = 0;
|
||||
Mutation typedOther = (Mutation)other;
|
||||
|
||||
lastComparison = Boolean.valueOf(isSetIsDelete()).compareTo(isSetIsDelete());
|
||||
lastComparison = Boolean.valueOf(isSetIsDelete()).compareTo(typedOther.isSetIsDelete());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
lastComparison = TBaseHelper.compareTo(isDelete, typedOther.isDelete);
|
||||
if (isSetIsDelete()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.isDelete, typedOther.isDelete);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetColumn()).compareTo(typedOther.isSetColumn());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetColumn()).compareTo(isSetColumn());
|
||||
if (isSetColumn()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.column, typedOther.column);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetValue()).compareTo(typedOther.isSetValue());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
lastComparison = TBaseHelper.compareTo(column, typedOther.column);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetValue()).compareTo(isSetValue());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
lastComparison = TBaseHelper.compareTo(value, typedOther.value);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
if (isSetValue()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.value, typedOther.value);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public _Fields fieldForId(int fieldId) {
|
||||
return _Fields.findByThriftId(fieldId);
|
||||
}
|
||||
|
||||
public void read(TProtocol iprot) throws TException {
|
||||
TField field;
|
||||
iprot.readStructBegin();
|
||||
@ -414,36 +431,33 @@ public class Mutation implements TBase<Mutation._Fields>, java.io.Serializable,
|
||||
if (field.type == TType.STOP) {
|
||||
break;
|
||||
}
|
||||
_Fields fieldId = _Fields.findByThriftId(field.id);
|
||||
if (fieldId == null) {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
} else {
|
||||
switch (fieldId) {
|
||||
case IS_DELETE:
|
||||
if (field.type == TType.BOOL) {
|
||||
this.isDelete = iprot.readBool();
|
||||
setIsDeleteIsSet(true);
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
case COLUMN:
|
||||
if (field.type == TType.STRING) {
|
||||
this.column = iprot.readBinary();
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
case VALUE:
|
||||
if (field.type == TType.STRING) {
|
||||
this.value = iprot.readBinary();
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
}
|
||||
iprot.readFieldEnd();
|
||||
switch (field.id) {
|
||||
case 1: // IS_DELETE
|
||||
if (field.type == TType.BOOL) {
|
||||
this.isDelete = iprot.readBool();
|
||||
setIsDeleteIsSet(true);
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
case 2: // COLUMN
|
||||
if (field.type == TType.STRING) {
|
||||
this.column = iprot.readBinary();
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
case 3: // VALUE
|
||||
if (field.type == TType.STRING) {
|
||||
this.value = iprot.readBinary();
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
iprot.readFieldEnd();
|
||||
}
|
||||
iprot.readStructEnd();
|
||||
|
||||
|
@ -17,7 +17,6 @@
|
||||
*/
|
||||
package org.apache.hadoop.hbase.thrift.generated;
|
||||
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
@ -28,12 +27,15 @@ import java.util.HashSet;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Collections;
|
||||
import java.util.BitSet;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Arrays;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.apache.thrift.*;
|
||||
import org.apache.thrift.async.*;
|
||||
import org.apache.thrift.meta_data.*;
|
||||
import org.apache.thrift.transport.*;
|
||||
import org.apache.thrift.protocol.*;
|
||||
|
||||
/**
|
||||
@ -42,13 +44,13 @@ import org.apache.thrift.protocol.*;
|
||||
* 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.
|
||||
*/
|
||||
public class TCell implements TBase<TCell._Fields>, java.io.Serializable, Cloneable, Comparable<TCell> {
|
||||
public class TCell implements TBase<TCell, TCell._Fields>, java.io.Serializable, Cloneable {
|
||||
private static final TStruct STRUCT_DESC = new TStruct("TCell");
|
||||
|
||||
private static final TField VALUE_FIELD_DESC = new TField("value", TType.STRING, (short)1);
|
||||
private static final TField TIMESTAMP_FIELD_DESC = new TField("timestamp", TType.I64, (short)2);
|
||||
|
||||
public byte[] value;
|
||||
public ByteBuffer value;
|
||||
public long timestamp;
|
||||
|
||||
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
|
||||
@ -56,12 +58,10 @@ public class TCell implements TBase<TCell._Fields>, java.io.Serializable, Clonea
|
||||
VALUE((short)1, "value"),
|
||||
TIMESTAMP((short)2, "timestamp");
|
||||
|
||||
private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
|
||||
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
|
||||
|
||||
static {
|
||||
for (_Fields field : EnumSet.allOf(_Fields.class)) {
|
||||
byId.put((int)field._thriftId, field);
|
||||
byName.put(field.getFieldName(), field);
|
||||
}
|
||||
}
|
||||
@ -70,7 +70,14 @@ public class TCell implements TBase<TCell._Fields>, java.io.Serializable, Clonea
|
||||
* Find the _Fields constant that matches fieldId, or null if its not found.
|
||||
*/
|
||||
public static _Fields findByThriftId(int fieldId) {
|
||||
return byId.get(fieldId);
|
||||
switch(fieldId) {
|
||||
case 1: // VALUE
|
||||
return VALUE;
|
||||
case 2: // TIMESTAMP
|
||||
return TIMESTAMP;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -111,14 +118,14 @@ public class TCell implements TBase<TCell._Fields>, java.io.Serializable, Clonea
|
||||
private static final int __TIMESTAMP_ISSET_ID = 0;
|
||||
private BitSet __isset_bit_vector = new BitSet(1);
|
||||
|
||||
public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
|
||||
put(_Fields.VALUE, new FieldMetaData("value", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.STRING)));
|
||||
put(_Fields.TIMESTAMP, new FieldMetaData("timestamp", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.I64)));
|
||||
}});
|
||||
|
||||
public static final Map<_Fields, FieldMetaData> metaDataMap;
|
||||
static {
|
||||
Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class);
|
||||
tmpMap.put(_Fields.VALUE, new FieldMetaData("value", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.STRING , "Bytes")));
|
||||
tmpMap.put(_Fields.TIMESTAMP, new FieldMetaData("timestamp", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.I64)));
|
||||
metaDataMap = Collections.unmodifiableMap(tmpMap);
|
||||
FieldMetaData.addStructMetaDataMap(TCell.class, metaDataMap);
|
||||
}
|
||||
|
||||
@ -126,7 +133,7 @@ public class TCell implements TBase<TCell._Fields>, java.io.Serializable, Clonea
|
||||
}
|
||||
|
||||
public TCell(
|
||||
byte[] value,
|
||||
ByteBuffer value,
|
||||
long timestamp)
|
||||
{
|
||||
this();
|
||||
@ -151,16 +158,28 @@ public class TCell implements TBase<TCell._Fields>, java.io.Serializable, Clonea
|
||||
return new TCell(this);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public TCell clone() {
|
||||
return new TCell(this);
|
||||
@Override
|
||||
public void clear() {
|
||||
this.value = null;
|
||||
setTimestampIsSet(false);
|
||||
this.timestamp = 0;
|
||||
}
|
||||
|
||||
public byte[] getValue() {
|
||||
return this.value;
|
||||
setValue(TBaseHelper.rightSize(value));
|
||||
return value.array();
|
||||
}
|
||||
|
||||
public ByteBuffer BufferForValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public TCell setValue(byte[] value) {
|
||||
setValue(ByteBuffer.wrap(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
public TCell setValue(ByteBuffer value) {
|
||||
this.value = value;
|
||||
return this;
|
||||
}
|
||||
@ -209,7 +228,7 @@ public class TCell implements TBase<TCell._Fields>, java.io.Serializable, Clonea
|
||||
if (value == null) {
|
||||
unsetValue();
|
||||
} else {
|
||||
setValue((byte[])value);
|
||||
setValue((ByteBuffer)value);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -224,10 +243,6 @@ public class TCell implements TBase<TCell._Fields>, java.io.Serializable, Clonea
|
||||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(int fieldID, Object value) {
|
||||
setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
|
||||
}
|
||||
|
||||
public Object getFieldValue(_Fields field) {
|
||||
switch (field) {
|
||||
case VALUE:
|
||||
@ -240,12 +255,12 @@ public class TCell implements TBase<TCell._Fields>, java.io.Serializable, Clonea
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public Object getFieldValue(int fieldId) {
|
||||
return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
|
||||
}
|
||||
|
||||
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
|
||||
public boolean isSet(_Fields field) {
|
||||
if (field == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
switch (field) {
|
||||
case VALUE:
|
||||
return isSetValue();
|
||||
@ -255,10 +270,6 @@ public class TCell implements TBase<TCell._Fields>, java.io.Serializable, Clonea
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public boolean isSet(int fieldID) {
|
||||
return isSet(_Fields.findByThriftIdOrThrow(fieldID));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that == null)
|
||||
@ -277,7 +288,7 @@ public class TCell implements TBase<TCell._Fields>, java.io.Serializable, Clonea
|
||||
if (this_present_value || that_present_value) {
|
||||
if (!(this_present_value && that_present_value))
|
||||
return false;
|
||||
if (!java.util.Arrays.equals(this.value, that.value))
|
||||
if (!this.value.equals(that.value))
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -295,19 +306,7 @@ public class TCell implements TBase<TCell._Fields>, java.io.Serializable, Clonea
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
HashCodeBuilder builder = new HashCodeBuilder();
|
||||
|
||||
boolean present_value = true && (isSetValue());
|
||||
builder.append(present_value);
|
||||
if (present_value)
|
||||
builder.append(value);
|
||||
|
||||
boolean present_timestamp = true;
|
||||
builder.append(present_timestamp);
|
||||
if (present_timestamp)
|
||||
builder.append(timestamp);
|
||||
|
||||
return builder.toHashCode();
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int compareTo(TCell other) {
|
||||
@ -318,25 +317,33 @@ public class TCell implements TBase<TCell._Fields>, java.io.Serializable, Clonea
|
||||
int lastComparison = 0;
|
||||
TCell typedOther = (TCell)other;
|
||||
|
||||
lastComparison = Boolean.valueOf(isSetValue()).compareTo(isSetValue());
|
||||
lastComparison = Boolean.valueOf(isSetValue()).compareTo(typedOther.isSetValue());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
lastComparison = TBaseHelper.compareTo(value, typedOther.value);
|
||||
if (isSetValue()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.value, typedOther.value);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetTimestamp()).compareTo(typedOther.isSetTimestamp());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetTimestamp()).compareTo(isSetTimestamp());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
lastComparison = TBaseHelper.compareTo(timestamp, typedOther.timestamp);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
if (isSetTimestamp()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.timestamp, typedOther.timestamp);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public _Fields fieldForId(int fieldId) {
|
||||
return _Fields.findByThriftId(fieldId);
|
||||
}
|
||||
|
||||
public void read(TProtocol iprot) throws TException {
|
||||
TField field;
|
||||
iprot.readStructBegin();
|
||||
@ -346,29 +353,26 @@ public class TCell implements TBase<TCell._Fields>, java.io.Serializable, Clonea
|
||||
if (field.type == TType.STOP) {
|
||||
break;
|
||||
}
|
||||
_Fields fieldId = _Fields.findByThriftId(field.id);
|
||||
if (fieldId == null) {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
} else {
|
||||
switch (fieldId) {
|
||||
case VALUE:
|
||||
if (field.type == TType.STRING) {
|
||||
this.value = iprot.readBinary();
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
case TIMESTAMP:
|
||||
if (field.type == TType.I64) {
|
||||
this.timestamp = iprot.readI64();
|
||||
setTimestampIsSet(true);
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
}
|
||||
iprot.readFieldEnd();
|
||||
switch (field.id) {
|
||||
case 1: // VALUE
|
||||
if (field.type == TType.STRING) {
|
||||
this.value = iprot.readBinary();
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
case 2: // TIMESTAMP
|
||||
if (field.type == TType.I64) {
|
||||
this.timestamp = iprot.readI64();
|
||||
setTimestampIsSet(true);
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
iprot.readFieldEnd();
|
||||
}
|
||||
iprot.readStructEnd();
|
||||
|
||||
|
@ -17,7 +17,6 @@
|
||||
*/
|
||||
package org.apache.hadoop.hbase.thrift.generated;
|
||||
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
@ -28,18 +27,21 @@ import java.util.HashSet;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Collections;
|
||||
import java.util.BitSet;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Arrays;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.apache.thrift.*;
|
||||
import org.apache.thrift.async.*;
|
||||
import org.apache.thrift.meta_data.*;
|
||||
import org.apache.thrift.transport.*;
|
||||
import org.apache.thrift.protocol.*;
|
||||
|
||||
/**
|
||||
* A TRegionInfo contains information about an HTable region.
|
||||
*/
|
||||
public class TRegionInfo implements TBase<TRegionInfo._Fields>, java.io.Serializable, Cloneable, Comparable<TRegionInfo> {
|
||||
public class TRegionInfo implements TBase<TRegionInfo, TRegionInfo._Fields>, java.io.Serializable, Cloneable {
|
||||
private static final TStruct STRUCT_DESC = new TStruct("TRegionInfo");
|
||||
|
||||
private static final TField START_KEY_FIELD_DESC = new TField("startKey", TType.STRING, (short)1);
|
||||
@ -48,10 +50,10 @@ public class TRegionInfo implements TBase<TRegionInfo._Fields>, java.io.Serializ
|
||||
private static final TField NAME_FIELD_DESC = new TField("name", TType.STRING, (short)4);
|
||||
private static final TField VERSION_FIELD_DESC = new TField("version", TType.BYTE, (short)5);
|
||||
|
||||
public byte[] startKey;
|
||||
public byte[] endKey;
|
||||
public ByteBuffer startKey;
|
||||
public ByteBuffer endKey;
|
||||
public long id;
|
||||
public byte[] name;
|
||||
public ByteBuffer name;
|
||||
public byte version;
|
||||
|
||||
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
|
||||
@ -62,12 +64,10 @@ public class TRegionInfo implements TBase<TRegionInfo._Fields>, java.io.Serializ
|
||||
NAME((short)4, "name"),
|
||||
VERSION((short)5, "version");
|
||||
|
||||
private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
|
||||
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
|
||||
|
||||
static {
|
||||
for (_Fields field : EnumSet.allOf(_Fields.class)) {
|
||||
byId.put((int)field._thriftId, field);
|
||||
byName.put(field.getFieldName(), field);
|
||||
}
|
||||
}
|
||||
@ -76,7 +76,20 @@ public class TRegionInfo implements TBase<TRegionInfo._Fields>, java.io.Serializ
|
||||
* Find the _Fields constant that matches fieldId, or null if its not found.
|
||||
*/
|
||||
public static _Fields findByThriftId(int fieldId) {
|
||||
return byId.get(fieldId);
|
||||
switch(fieldId) {
|
||||
case 1: // START_KEY
|
||||
return START_KEY;
|
||||
case 2: // END_KEY
|
||||
return END_KEY;
|
||||
case 3: // ID
|
||||
return ID;
|
||||
case 4: // NAME
|
||||
return NAME;
|
||||
case 5: // VERSION
|
||||
return VERSION;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -118,20 +131,20 @@ public class TRegionInfo implements TBase<TRegionInfo._Fields>, java.io.Serializ
|
||||
private static final int __VERSION_ISSET_ID = 1;
|
||||
private BitSet __isset_bit_vector = new BitSet(2);
|
||||
|
||||
public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
|
||||
put(_Fields.START_KEY, new FieldMetaData("startKey", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.STRING)));
|
||||
put(_Fields.END_KEY, new FieldMetaData("endKey", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.STRING)));
|
||||
put(_Fields.ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.I64)));
|
||||
put(_Fields.NAME, new FieldMetaData("name", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.STRING)));
|
||||
put(_Fields.VERSION, new FieldMetaData("version", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.BYTE)));
|
||||
}});
|
||||
|
||||
public static final Map<_Fields, FieldMetaData> metaDataMap;
|
||||
static {
|
||||
Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class);
|
||||
tmpMap.put(_Fields.START_KEY, new FieldMetaData("startKey", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.STRING , "Text")));
|
||||
tmpMap.put(_Fields.END_KEY, new FieldMetaData("endKey", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.STRING , "Text")));
|
||||
tmpMap.put(_Fields.ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.I64)));
|
||||
tmpMap.put(_Fields.NAME, new FieldMetaData("name", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.STRING , "Text")));
|
||||
tmpMap.put(_Fields.VERSION, new FieldMetaData("version", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.BYTE)));
|
||||
metaDataMap = Collections.unmodifiableMap(tmpMap);
|
||||
FieldMetaData.addStructMetaDataMap(TRegionInfo.class, metaDataMap);
|
||||
}
|
||||
|
||||
@ -139,10 +152,10 @@ public class TRegionInfo implements TBase<TRegionInfo._Fields>, java.io.Serializ
|
||||
}
|
||||
|
||||
public TRegionInfo(
|
||||
byte[] startKey,
|
||||
byte[] endKey,
|
||||
ByteBuffer startKey,
|
||||
ByteBuffer endKey,
|
||||
long id,
|
||||
byte[] name,
|
||||
ByteBuffer name,
|
||||
byte version)
|
||||
{
|
||||
this();
|
||||
@ -178,16 +191,32 @@ public class TRegionInfo implements TBase<TRegionInfo._Fields>, java.io.Serializ
|
||||
return new TRegionInfo(this);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public TRegionInfo clone() {
|
||||
return new TRegionInfo(this);
|
||||
@Override
|
||||
public void clear() {
|
||||
this.startKey = null;
|
||||
this.endKey = null;
|
||||
setIdIsSet(false);
|
||||
this.id = 0;
|
||||
this.name = null;
|
||||
setVersionIsSet(false);
|
||||
this.version = 0;
|
||||
}
|
||||
|
||||
public byte[] getStartKey() {
|
||||
return this.startKey;
|
||||
setStartKey(TBaseHelper.rightSize(startKey));
|
||||
return startKey.array();
|
||||
}
|
||||
|
||||
public ByteBuffer BufferForStartKey() {
|
||||
return startKey;
|
||||
}
|
||||
|
||||
public TRegionInfo setStartKey(byte[] startKey) {
|
||||
setStartKey(ByteBuffer.wrap(startKey));
|
||||
return this;
|
||||
}
|
||||
|
||||
public TRegionInfo setStartKey(ByteBuffer startKey) {
|
||||
this.startKey = startKey;
|
||||
return this;
|
||||
}
|
||||
@ -208,10 +237,20 @@ public class TRegionInfo implements TBase<TRegionInfo._Fields>, java.io.Serializ
|
||||
}
|
||||
|
||||
public byte[] getEndKey() {
|
||||
return this.endKey;
|
||||
setEndKey(TBaseHelper.rightSize(endKey));
|
||||
return endKey.array();
|
||||
}
|
||||
|
||||
public ByteBuffer BufferForEndKey() {
|
||||
return endKey;
|
||||
}
|
||||
|
||||
public TRegionInfo setEndKey(byte[] endKey) {
|
||||
setEndKey(ByteBuffer.wrap(endKey));
|
||||
return this;
|
||||
}
|
||||
|
||||
public TRegionInfo setEndKey(ByteBuffer endKey) {
|
||||
this.endKey = endKey;
|
||||
return this;
|
||||
}
|
||||
@ -255,10 +294,20 @@ public class TRegionInfo implements TBase<TRegionInfo._Fields>, java.io.Serializ
|
||||
}
|
||||
|
||||
public byte[] getName() {
|
||||
return this.name;
|
||||
setName(TBaseHelper.rightSize(name));
|
||||
return name.array();
|
||||
}
|
||||
|
||||
public ByteBuffer BufferForName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public TRegionInfo setName(byte[] name) {
|
||||
setName(ByteBuffer.wrap(name));
|
||||
return this;
|
||||
}
|
||||
|
||||
public TRegionInfo setName(ByteBuffer name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
@ -307,7 +356,7 @@ public class TRegionInfo implements TBase<TRegionInfo._Fields>, java.io.Serializ
|
||||
if (value == null) {
|
||||
unsetStartKey();
|
||||
} else {
|
||||
setStartKey((byte[])value);
|
||||
setStartKey((ByteBuffer)value);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -315,7 +364,7 @@ public class TRegionInfo implements TBase<TRegionInfo._Fields>, java.io.Serializ
|
||||
if (value == null) {
|
||||
unsetEndKey();
|
||||
} else {
|
||||
setEndKey((byte[])value);
|
||||
setEndKey((ByteBuffer)value);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -331,7 +380,7 @@ public class TRegionInfo implements TBase<TRegionInfo._Fields>, java.io.Serializ
|
||||
if (value == null) {
|
||||
unsetName();
|
||||
} else {
|
||||
setName((byte[])value);
|
||||
setName((ByteBuffer)value);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -346,10 +395,6 @@ public class TRegionInfo implements TBase<TRegionInfo._Fields>, java.io.Serializ
|
||||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(int fieldID, Object value) {
|
||||
setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
|
||||
}
|
||||
|
||||
public Object getFieldValue(_Fields field) {
|
||||
switch (field) {
|
||||
case START_KEY:
|
||||
@ -371,12 +416,12 @@ public class TRegionInfo implements TBase<TRegionInfo._Fields>, java.io.Serializ
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public Object getFieldValue(int fieldId) {
|
||||
return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
|
||||
}
|
||||
|
||||
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
|
||||
public boolean isSet(_Fields field) {
|
||||
if (field == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
switch (field) {
|
||||
case START_KEY:
|
||||
return isSetStartKey();
|
||||
@ -392,10 +437,6 @@ public class TRegionInfo implements TBase<TRegionInfo._Fields>, java.io.Serializ
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public boolean isSet(int fieldID) {
|
||||
return isSet(_Fields.findByThriftIdOrThrow(fieldID));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that == null)
|
||||
@ -414,7 +455,7 @@ public class TRegionInfo implements TBase<TRegionInfo._Fields>, java.io.Serializ
|
||||
if (this_present_startKey || that_present_startKey) {
|
||||
if (!(this_present_startKey && that_present_startKey))
|
||||
return false;
|
||||
if (!java.util.Arrays.equals(this.startKey, that.startKey))
|
||||
if (!this.startKey.equals(that.startKey))
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -423,7 +464,7 @@ public class TRegionInfo implements TBase<TRegionInfo._Fields>, java.io.Serializ
|
||||
if (this_present_endKey || that_present_endKey) {
|
||||
if (!(this_present_endKey && that_present_endKey))
|
||||
return false;
|
||||
if (!java.util.Arrays.equals(this.endKey, that.endKey))
|
||||
if (!this.endKey.equals(that.endKey))
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -441,7 +482,7 @@ public class TRegionInfo implements TBase<TRegionInfo._Fields>, java.io.Serializ
|
||||
if (this_present_name || that_present_name) {
|
||||
if (!(this_present_name && that_present_name))
|
||||
return false;
|
||||
if (!java.util.Arrays.equals(this.name, that.name))
|
||||
if (!this.name.equals(that.name))
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -459,34 +500,7 @@ public class TRegionInfo implements TBase<TRegionInfo._Fields>, java.io.Serializ
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
HashCodeBuilder builder = new HashCodeBuilder();
|
||||
|
||||
boolean present_startKey = true && (isSetStartKey());
|
||||
builder.append(present_startKey);
|
||||
if (present_startKey)
|
||||
builder.append(startKey);
|
||||
|
||||
boolean present_endKey = true && (isSetEndKey());
|
||||
builder.append(present_endKey);
|
||||
if (present_endKey)
|
||||
builder.append(endKey);
|
||||
|
||||
boolean present_id = true;
|
||||
builder.append(present_id);
|
||||
if (present_id)
|
||||
builder.append(id);
|
||||
|
||||
boolean present_name = true && (isSetName());
|
||||
builder.append(present_name);
|
||||
if (present_name)
|
||||
builder.append(name);
|
||||
|
||||
boolean present_version = true;
|
||||
builder.append(present_version);
|
||||
if (present_version)
|
||||
builder.append(version);
|
||||
|
||||
return builder.toHashCode();
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int compareTo(TRegionInfo other) {
|
||||
@ -497,49 +511,63 @@ public class TRegionInfo implements TBase<TRegionInfo._Fields>, java.io.Serializ
|
||||
int lastComparison = 0;
|
||||
TRegionInfo typedOther = (TRegionInfo)other;
|
||||
|
||||
lastComparison = Boolean.valueOf(isSetStartKey()).compareTo(isSetStartKey());
|
||||
lastComparison = Boolean.valueOf(isSetStartKey()).compareTo(typedOther.isSetStartKey());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
lastComparison = TBaseHelper.compareTo(startKey, typedOther.startKey);
|
||||
if (isSetStartKey()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.startKey, typedOther.startKey);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetEndKey()).compareTo(typedOther.isSetEndKey());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetEndKey()).compareTo(isSetEndKey());
|
||||
if (isSetEndKey()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.endKey, typedOther.endKey);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetId()).compareTo(typedOther.isSetId());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
lastComparison = TBaseHelper.compareTo(endKey, typedOther.endKey);
|
||||
if (isSetId()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.id, typedOther.id);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetName()).compareTo(typedOther.isSetName());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetId()).compareTo(isSetId());
|
||||
if (isSetName()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.name, typedOther.name);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetVersion()).compareTo(typedOther.isSetVersion());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
lastComparison = TBaseHelper.compareTo(id, typedOther.id);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetName()).compareTo(isSetName());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
lastComparison = TBaseHelper.compareTo(name, typedOther.name);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetVersion()).compareTo(isSetVersion());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
lastComparison = TBaseHelper.compareTo(version, typedOther.version);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
if (isSetVersion()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.version, typedOther.version);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public _Fields fieldForId(int fieldId) {
|
||||
return _Fields.findByThriftId(fieldId);
|
||||
}
|
||||
|
||||
public void read(TProtocol iprot) throws TException {
|
||||
TField field;
|
||||
iprot.readStructBegin();
|
||||
@ -549,51 +577,48 @@ public class TRegionInfo implements TBase<TRegionInfo._Fields>, java.io.Serializ
|
||||
if (field.type == TType.STOP) {
|
||||
break;
|
||||
}
|
||||
_Fields fieldId = _Fields.findByThriftId(field.id);
|
||||
if (fieldId == null) {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
} else {
|
||||
switch (fieldId) {
|
||||
case START_KEY:
|
||||
if (field.type == TType.STRING) {
|
||||
this.startKey = iprot.readBinary();
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
case END_KEY:
|
||||
if (field.type == TType.STRING) {
|
||||
this.endKey = iprot.readBinary();
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
case ID:
|
||||
if (field.type == TType.I64) {
|
||||
this.id = iprot.readI64();
|
||||
setIdIsSet(true);
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
case NAME:
|
||||
if (field.type == TType.STRING) {
|
||||
this.name = iprot.readBinary();
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
case VERSION:
|
||||
if (field.type == TType.BYTE) {
|
||||
this.version = iprot.readByte();
|
||||
setVersionIsSet(true);
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
}
|
||||
iprot.readFieldEnd();
|
||||
switch (field.id) {
|
||||
case 1: // START_KEY
|
||||
if (field.type == TType.STRING) {
|
||||
this.startKey = iprot.readBinary();
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
case 2: // END_KEY
|
||||
if (field.type == TType.STRING) {
|
||||
this.endKey = iprot.readBinary();
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
case 3: // ID
|
||||
if (field.type == TType.I64) {
|
||||
this.id = iprot.readI64();
|
||||
setIdIsSet(true);
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
case 4: // NAME
|
||||
if (field.type == TType.STRING) {
|
||||
this.name = iprot.readBinary();
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
case 5: // VERSION
|
||||
if (field.type == TType.BYTE) {
|
||||
this.version = iprot.readByte();
|
||||
setVersionIsSet(true);
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
iprot.readFieldEnd();
|
||||
}
|
||||
iprot.readStructEnd();
|
||||
|
||||
|
@ -17,7 +17,6 @@
|
||||
*/
|
||||
package org.apache.hadoop.hbase.thrift.generated;
|
||||
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
@ -28,37 +27,38 @@ import java.util.HashSet;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Collections;
|
||||
import java.util.BitSet;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Arrays;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.apache.thrift.*;
|
||||
import org.apache.thrift.async.*;
|
||||
import org.apache.thrift.meta_data.*;
|
||||
import org.apache.thrift.transport.*;
|
||||
import org.apache.thrift.protocol.*;
|
||||
|
||||
/**
|
||||
* Holds row name and then a map of columns to cells.
|
||||
*/
|
||||
public class TRowResult implements TBase<TRowResult._Fields>, java.io.Serializable, Cloneable {
|
||||
public class TRowResult implements TBase<TRowResult, TRowResult._Fields>, java.io.Serializable, Cloneable {
|
||||
private static final TStruct STRUCT_DESC = new TStruct("TRowResult");
|
||||
|
||||
private static final TField ROW_FIELD_DESC = new TField("row", TType.STRING, (short)1);
|
||||
private static final TField COLUMNS_FIELD_DESC = new TField("columns", TType.MAP, (short)2);
|
||||
|
||||
public byte[] row;
|
||||
public Map<byte[],TCell> columns;
|
||||
public ByteBuffer row;
|
||||
public Map<ByteBuffer,TCell> columns;
|
||||
|
||||
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
|
||||
public enum _Fields implements TFieldIdEnum {
|
||||
ROW((short)1, "row"),
|
||||
COLUMNS((short)2, "columns");
|
||||
|
||||
private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
|
||||
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
|
||||
|
||||
static {
|
||||
for (_Fields field : EnumSet.allOf(_Fields.class)) {
|
||||
byId.put((int)field._thriftId, field);
|
||||
byName.put(field.getFieldName(), field);
|
||||
}
|
||||
}
|
||||
@ -67,7 +67,14 @@ public class TRowResult implements TBase<TRowResult._Fields>, java.io.Serializab
|
||||
* Find the _Fields constant that matches fieldId, or null if its not found.
|
||||
*/
|
||||
public static _Fields findByThriftId(int fieldId) {
|
||||
return byId.get(fieldId);
|
||||
switch(fieldId) {
|
||||
case 1: // ROW
|
||||
return ROW;
|
||||
case 2: // COLUMNS
|
||||
return COLUMNS;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -106,16 +113,16 @@ public class TRowResult implements TBase<TRowResult._Fields>, java.io.Serializab
|
||||
|
||||
// isset id assignments
|
||||
|
||||
public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
|
||||
put(_Fields.ROW, new FieldMetaData("row", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.STRING)));
|
||||
put(_Fields.COLUMNS, new FieldMetaData("columns", TFieldRequirementType.DEFAULT,
|
||||
new MapMetaData(TType.MAP,
|
||||
new FieldValueMetaData(TType.STRING),
|
||||
new StructMetaData(TType.STRUCT, TCell.class))));
|
||||
}});
|
||||
|
||||
public static final Map<_Fields, FieldMetaData> metaDataMap;
|
||||
static {
|
||||
Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class);
|
||||
tmpMap.put(_Fields.ROW, new FieldMetaData("row", TFieldRequirementType.DEFAULT,
|
||||
new FieldValueMetaData(TType.STRING , "Text")));
|
||||
tmpMap.put(_Fields.COLUMNS, new FieldMetaData("columns", TFieldRequirementType.DEFAULT,
|
||||
new MapMetaData(TType.MAP,
|
||||
new FieldValueMetaData(TType.STRING , "Text"),
|
||||
new StructMetaData(TType.STRUCT, TCell.class))));
|
||||
metaDataMap = Collections.unmodifiableMap(tmpMap);
|
||||
FieldMetaData.addStructMetaDataMap(TRowResult.class, metaDataMap);
|
||||
}
|
||||
|
||||
@ -123,8 +130,8 @@ public class TRowResult implements TBase<TRowResult._Fields>, java.io.Serializab
|
||||
}
|
||||
|
||||
public TRowResult(
|
||||
byte[] row,
|
||||
Map<byte[],TCell> columns)
|
||||
ByteBuffer row,
|
||||
Map<ByteBuffer,TCell> columns)
|
||||
{
|
||||
this();
|
||||
this.row = row;
|
||||
@ -139,13 +146,13 @@ public class TRowResult implements TBase<TRowResult._Fields>, java.io.Serializab
|
||||
this.row = other.row;
|
||||
}
|
||||
if (other.isSetColumns()) {
|
||||
Map<byte[],TCell> __this__columns = new HashMap<byte[],TCell>();
|
||||
for (Map.Entry<byte[], TCell> other_element : other.columns.entrySet()) {
|
||||
Map<ByteBuffer,TCell> __this__columns = new HashMap<ByteBuffer,TCell>();
|
||||
for (Map.Entry<ByteBuffer, TCell> other_element : other.columns.entrySet()) {
|
||||
|
||||
byte[] other_element_key = other_element.getKey();
|
||||
ByteBuffer other_element_key = other_element.getKey();
|
||||
TCell other_element_value = other_element.getValue();
|
||||
|
||||
byte[] __this__columns_copy_key = other_element_key;
|
||||
ByteBuffer __this__columns_copy_key = other_element_key;
|
||||
|
||||
TCell __this__columns_copy_value = new TCell(other_element_value);
|
||||
|
||||
@ -159,16 +166,27 @@ public class TRowResult implements TBase<TRowResult._Fields>, java.io.Serializab
|
||||
return new TRowResult(this);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public TRowResult clone() {
|
||||
return new TRowResult(this);
|
||||
@Override
|
||||
public void clear() {
|
||||
this.row = null;
|
||||
this.columns = null;
|
||||
}
|
||||
|
||||
public byte[] getRow() {
|
||||
return this.row;
|
||||
setRow(TBaseHelper.rightSize(row));
|
||||
return row.array();
|
||||
}
|
||||
|
||||
public ByteBuffer BufferForRow() {
|
||||
return row;
|
||||
}
|
||||
|
||||
public TRowResult setRow(byte[] row) {
|
||||
setRow(ByteBuffer.wrap(row));
|
||||
return this;
|
||||
}
|
||||
|
||||
public TRowResult setRow(ByteBuffer row) {
|
||||
this.row = row;
|
||||
return this;
|
||||
}
|
||||
@ -192,18 +210,18 @@ public class TRowResult implements TBase<TRowResult._Fields>, java.io.Serializab
|
||||
return (this.columns == null) ? 0 : this.columns.size();
|
||||
}
|
||||
|
||||
public void putToColumns(byte[] key, TCell val) {
|
||||
public void putToColumns(ByteBuffer key, TCell val) {
|
||||
if (this.columns == null) {
|
||||
this.columns = new HashMap<byte[],TCell>();
|
||||
this.columns = new HashMap<ByteBuffer,TCell>();
|
||||
}
|
||||
this.columns.put(key, val);
|
||||
}
|
||||
|
||||
public Map<byte[],TCell> getColumns() {
|
||||
public Map<ByteBuffer,TCell> getColumns() {
|
||||
return this.columns;
|
||||
}
|
||||
|
||||
public TRowResult setColumns(Map<byte[],TCell> columns) {
|
||||
public TRowResult setColumns(Map<ByteBuffer,TCell> columns) {
|
||||
this.columns = columns;
|
||||
return this;
|
||||
}
|
||||
@ -229,7 +247,7 @@ public class TRowResult implements TBase<TRowResult._Fields>, java.io.Serializab
|
||||
if (value == null) {
|
||||
unsetRow();
|
||||
} else {
|
||||
setRow((byte[])value);
|
||||
setRow((ByteBuffer)value);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -237,17 +255,13 @@ public class TRowResult implements TBase<TRowResult._Fields>, java.io.Serializab
|
||||
if (value == null) {
|
||||
unsetColumns();
|
||||
} else {
|
||||
setColumns((Map<byte[],TCell>)value);
|
||||
setColumns((Map<ByteBuffer,TCell>)value);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(int fieldID, Object value) {
|
||||
setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
|
||||
}
|
||||
|
||||
public Object getFieldValue(_Fields field) {
|
||||
switch (field) {
|
||||
case ROW:
|
||||
@ -260,12 +274,12 @@ public class TRowResult implements TBase<TRowResult._Fields>, java.io.Serializab
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public Object getFieldValue(int fieldId) {
|
||||
return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
|
||||
}
|
||||
|
||||
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
|
||||
public boolean isSet(_Fields field) {
|
||||
if (field == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
switch (field) {
|
||||
case ROW:
|
||||
return isSetRow();
|
||||
@ -275,10 +289,6 @@ public class TRowResult implements TBase<TRowResult._Fields>, java.io.Serializab
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public boolean isSet(int fieldID) {
|
||||
return isSet(_Fields.findByThriftIdOrThrow(fieldID));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that == null)
|
||||
@ -297,7 +307,7 @@ public class TRowResult implements TBase<TRowResult._Fields>, java.io.Serializab
|
||||
if (this_present_row || that_present_row) {
|
||||
if (!(this_present_row && that_present_row))
|
||||
return false;
|
||||
if (!java.util.Arrays.equals(this.row, that.row))
|
||||
if (!this.row.equals(that.row))
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -315,19 +325,42 @@ public class TRowResult implements TBase<TRowResult._Fields>, java.io.Serializab
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
HashCodeBuilder builder = new HashCodeBuilder();
|
||||
return 0;
|
||||
}
|
||||
|
||||
boolean present_row = true && (isSetRow());
|
||||
builder.append(present_row);
|
||||
if (present_row)
|
||||
builder.append(row);
|
||||
public int compareTo(TRowResult other) {
|
||||
if (!getClass().equals(other.getClass())) {
|
||||
return getClass().getName().compareTo(other.getClass().getName());
|
||||
}
|
||||
|
||||
boolean present_columns = true && (isSetColumns());
|
||||
builder.append(present_columns);
|
||||
if (present_columns)
|
||||
builder.append(columns);
|
||||
int lastComparison = 0;
|
||||
TRowResult typedOther = (TRowResult)other;
|
||||
|
||||
return builder.toHashCode();
|
||||
lastComparison = Boolean.valueOf(isSetRow()).compareTo(typedOther.isSetRow());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetRow()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.row, typedOther.row);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetColumns()).compareTo(typedOther.isSetColumns());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetColumns()) {
|
||||
lastComparison = TBaseHelper.compareTo(this.columns, typedOther.columns);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public _Fields fieldForId(int fieldId) {
|
||||
return _Fields.findByThriftId(fieldId);
|
||||
}
|
||||
|
||||
public void read(TProtocol iprot) throws TException {
|
||||
@ -339,41 +372,38 @@ public class TRowResult implements TBase<TRowResult._Fields>, java.io.Serializab
|
||||
if (field.type == TType.STOP) {
|
||||
break;
|
||||
}
|
||||
_Fields fieldId = _Fields.findByThriftId(field.id);
|
||||
if (fieldId == null) {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
} else {
|
||||
switch (fieldId) {
|
||||
case ROW:
|
||||
if (field.type == TType.STRING) {
|
||||
this.row = iprot.readBinary();
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
case COLUMNS:
|
||||
if (field.type == TType.MAP) {
|
||||
switch (field.id) {
|
||||
case 1: // ROW
|
||||
if (field.type == TType.STRING) {
|
||||
this.row = iprot.readBinary();
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
case 2: // COLUMNS
|
||||
if (field.type == TType.MAP) {
|
||||
{
|
||||
TMap _map4 = iprot.readMapBegin();
|
||||
this.columns = new HashMap<ByteBuffer,TCell>(2*_map4.size);
|
||||
for (int _i5 = 0; _i5 < _map4.size; ++_i5)
|
||||
{
|
||||
TMap _map4 = iprot.readMapBegin();
|
||||
this.columns = new HashMap<byte[],TCell>(2*_map4.size);
|
||||
for (int _i5 = 0; _i5 < _map4.size; ++_i5)
|
||||
{
|
||||
byte[] _key6;
|
||||
TCell _val7;
|
||||
_key6 = iprot.readBinary();
|
||||
_val7 = new TCell();
|
||||
_val7.read(iprot);
|
||||
this.columns.put(_key6, _val7);
|
||||
}
|
||||
iprot.readMapEnd();
|
||||
ByteBuffer _key6;
|
||||
TCell _val7;
|
||||
_key6 = iprot.readBinary();
|
||||
_val7 = new TCell();
|
||||
_val7.read(iprot);
|
||||
this.columns.put(_key6, _val7);
|
||||
}
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
iprot.readMapEnd();
|
||||
}
|
||||
break;
|
||||
}
|
||||
iprot.readFieldEnd();
|
||||
} else {
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
TProtocolUtil.skip(iprot, field.type);
|
||||
}
|
||||
iprot.readFieldEnd();
|
||||
}
|
||||
iprot.readStructEnd();
|
||||
|
||||
@ -394,7 +424,7 @@ public class TRowResult implements TBase<TRowResult._Fields>, java.io.Serializab
|
||||
oprot.writeFieldBegin(COLUMNS_FIELD_DESC);
|
||||
{
|
||||
oprot.writeMapBegin(new TMap(TType.STRING, TType.STRUCT, this.columns.size()));
|
||||
for (Map.Entry<byte[], TCell> _iter8 : this.columns.entrySet())
|
||||
for (Map.Entry<ByteBuffer, TCell> _iter8 : this.columns.entrySet())
|
||||
{
|
||||
oprot.writeBinary(_iter8.getKey());
|
||||
_iter8.getValue().write(oprot);
|
||||
|
@ -730,6 +730,20 @@ public class Bytes {
|
||||
return n;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will get a sequence of bytes from pos -> limit,
|
||||
* but will restore pos after.
|
||||
* @param buf
|
||||
* @return
|
||||
*/
|
||||
public static byte[] getBytes(ByteBuffer buf) {
|
||||
int savedPos = buf.position();
|
||||
byte [] newBytes = new byte[buf.remaining()];
|
||||
buf.get(newBytes);
|
||||
buf.position(savedPos);
|
||||
return newBytes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Put a short value out to the specified byte array position.
|
||||
* @param bytes the byte array
|
||||
|
@ -19,6 +19,7 @@
|
||||
*/
|
||||
package org.apache.hadoop.hbase.thrift;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -36,17 +37,20 @@ import org.apache.hadoop.hbase.util.Bytes;
|
||||
*/
|
||||
public class TestThriftServer extends HBaseClusterTestCase {
|
||||
|
||||
private static ByteBuffer $bb(String i) {
|
||||
return ByteBuffer.wrap(Bytes.toBytes(i));
|
||||
}
|
||||
// Static names for tables, columns, rows, and values
|
||||
private static byte[] tableAname = Bytes.toBytes("tableA");
|
||||
private static byte[] tableBname = Bytes.toBytes("tableB");
|
||||
private static byte[] columnAname = Bytes.toBytes("columnA:");
|
||||
private static byte[] columnBname = Bytes.toBytes("columnB:");
|
||||
private static byte[] rowAname = Bytes.toBytes("rowA");
|
||||
private static byte[] rowBname = Bytes.toBytes("rowB");
|
||||
private static byte[] valueAname = Bytes.toBytes("valueA");
|
||||
private static byte[] valueBname = Bytes.toBytes("valueB");
|
||||
private static byte[] valueCname = Bytes.toBytes("valueC");
|
||||
private static byte[] valueDname = Bytes.toBytes("valueD");
|
||||
private static ByteBuffer tableAname = $bb("tableA");
|
||||
private static ByteBuffer tableBname = $bb("tableB");
|
||||
private static ByteBuffer columnAname = $bb("columnA:");
|
||||
private static ByteBuffer columnBname = $bb("columnB:");
|
||||
private static ByteBuffer rowAname = $bb("rowA");
|
||||
private static ByteBuffer rowBname = $bb("rowB");
|
||||
private static ByteBuffer valueAname = $bb("valueA");
|
||||
private static ByteBuffer valueBname = $bb("valueB");
|
||||
private static ByteBuffer valueCname = $bb("valueC");
|
||||
private static ByteBuffer valueDname = $bb("valueD");
|
||||
|
||||
/**
|
||||
* Runs all of the tests under a single JUnit test method. We
|
||||
@ -113,12 +117,12 @@ public class TestThriftServer extends HBaseClusterTestCase {
|
||||
handler.mutateRow(tableAname, rowAname, getMutations());
|
||||
|
||||
// Assert that the changes were made
|
||||
assertTrue(Bytes.equals(valueAname,
|
||||
handler.get(tableAname, rowAname, columnAname).get(0).value));
|
||||
assertEquals(valueAname,
|
||||
handler.get(tableAname, rowAname, columnAname).get(0).value);
|
||||
TRowResult rowResult1 = handler.getRow(tableAname, rowAname).get(0);
|
||||
assertTrue(Bytes.equals(rowAname, rowResult1.row));
|
||||
assertTrue(Bytes.equals(valueBname,
|
||||
rowResult1.columns.get(columnBname).value));
|
||||
assertEquals(rowAname, rowResult1.row);
|
||||
assertEquals(valueBname,
|
||||
rowResult1.columns.get(columnBname).value);
|
||||
|
||||
// Apply a few BatchMutations for rowA and rowB
|
||||
// rowAmutations.add(new Mutation(true, columnAname, null));
|
||||
@ -133,16 +137,16 @@ public class TestThriftServer extends HBaseClusterTestCase {
|
||||
// Assert that changes were made to rowA
|
||||
List<TCell> cells = handler.get(tableAname, rowAname, columnAname);
|
||||
assertFalse(cells.size() > 0);
|
||||
assertTrue(Bytes.equals(valueCname, handler.get(tableAname, rowAname, columnBname).get(0).value));
|
||||
assertEquals(valueCname, handler.get(tableAname, rowAname, columnBname).get(0).value);
|
||||
List<TCell> versions = handler.getVer(tableAname, rowAname, columnBname, MAXVERSIONS);
|
||||
assertTrue(Bytes.equals(valueCname, versions.get(0).value));
|
||||
assertTrue(Bytes.equals(valueBname, versions.get(1).value));
|
||||
assertEquals(valueCname, versions.get(0).value);
|
||||
assertEquals(valueBname, versions.get(1).value);
|
||||
|
||||
// Assert that changes were made to rowB
|
||||
TRowResult rowResult2 = handler.getRow(tableAname, rowBname).get(0);
|
||||
assertTrue(Bytes.equals(rowBname, rowResult2.row));
|
||||
assertTrue(Bytes.equals(valueCname, rowResult2.columns.get(columnAname).value));
|
||||
assertTrue(Bytes.equals(valueDname, rowResult2.columns.get(columnBname).value));
|
||||
assertEquals(rowBname, rowResult2.row);
|
||||
assertEquals(valueCname, rowResult2.columns.get(columnAname).value);
|
||||
assertEquals(valueDname, rowResult2.columns.get(columnBname).value);
|
||||
|
||||
// Apply some deletes
|
||||
handler.deleteAll(tableAname, rowAname, columnBname);
|
||||
@ -198,21 +202,21 @@ public class TestThriftServer extends HBaseClusterTestCase {
|
||||
TRowResult rowResult2 = handler.getRowTs(tableAname, rowAname, time2).get(0);
|
||||
// columnA was completely deleted
|
||||
//assertTrue(Bytes.equals(rowResult1.columns.get(columnAname).value, valueAname));
|
||||
assertTrue(Bytes.equals(rowResult1.columns.get(columnBname).value, valueBname));
|
||||
assertTrue(Bytes.equals(rowResult2.columns.get(columnBname).value, valueCname));
|
||||
assertEquals(rowResult1.columns.get(columnBname).value, valueBname);
|
||||
assertEquals(rowResult2.columns.get(columnBname).value, valueCname);
|
||||
|
||||
// ColumnAname has been deleted, and will never be visible even with a getRowTs()
|
||||
assertFalse(rowResult2.columns.containsKey(columnAname));
|
||||
|
||||
List<byte[]> columns = new ArrayList<byte[]>();
|
||||
List<ByteBuffer> columns = new ArrayList<ByteBuffer>();
|
||||
columns.add(columnBname);
|
||||
|
||||
rowResult1 = handler.getRowWithColumns(tableAname, rowAname, columns).get(0);
|
||||
assertTrue(Bytes.equals(rowResult1.columns.get(columnBname).value, valueCname));
|
||||
assertEquals(rowResult1.columns.get(columnBname).value, valueCname);
|
||||
assertFalse(rowResult1.columns.containsKey(columnAname));
|
||||
|
||||
rowResult1 = handler.getRowWithColumnsTs(tableAname, rowAname, columns, time1).get(0);
|
||||
assertTrue(Bytes.equals(rowResult1.columns.get(columnBname).value, valueBname));
|
||||
assertEquals(rowResult1.columns.get(columnBname).value, valueBname);
|
||||
assertFalse(rowResult1.columns.containsKey(columnAname));
|
||||
|
||||
// Apply some timestamped deletes
|
||||
@ -229,7 +233,7 @@ public class TestThriftServer extends HBaseClusterTestCase {
|
||||
assertEquals(1, size);
|
||||
|
||||
// should be available....
|
||||
assertTrue(Bytes.equals(handler.get(tableAname, rowAname, columnBname).get(0).value, valueCname));
|
||||
assertEquals(handler.get(tableAname, rowAname, columnBname).get(0).value, valueCname);
|
||||
|
||||
assertEquals(0, handler.getRow(tableAname, rowBname).size());
|
||||
|
||||
@ -266,18 +270,18 @@ public class TestThriftServer extends HBaseClusterTestCase {
|
||||
// Test a scanner on all rows and all columns, no timestamp
|
||||
int scanner1 = handler.scannerOpen(tableAname, rowAname, getColumnList(true, true));
|
||||
TRowResult rowResult1a = handler.scannerGet(scanner1).get(0);
|
||||
assertTrue(Bytes.equals(rowResult1a.row, rowAname));
|
||||
assertEquals(rowResult1a.row, rowAname);
|
||||
// This used to be '1'. I don't know why when we are asking for two columns
|
||||
// and when the mutations above would seem to add two columns to the row.
|
||||
// -- St.Ack 05/12/2009
|
||||
assertEquals(rowResult1a.columns.size(), 1);
|
||||
assertTrue(Bytes.equals(rowResult1a.columns.get(columnBname).value, valueCname));
|
||||
assertEquals(rowResult1a.columns.get(columnBname).value, valueCname);
|
||||
|
||||
TRowResult rowResult1b = handler.scannerGet(scanner1).get(0);
|
||||
assertTrue(Bytes.equals(rowResult1b.row, rowBname));
|
||||
assertEquals(rowResult1b.row, rowBname);
|
||||
assertEquals(rowResult1b.columns.size(), 2);
|
||||
assertTrue(Bytes.equals(rowResult1b.columns.get(columnAname).value, valueCname));
|
||||
assertTrue(Bytes.equals(rowResult1b.columns.get(columnBname).value, valueDname));
|
||||
assertEquals(rowResult1b.columns.get(columnAname).value, valueCname);
|
||||
assertEquals(rowResult1b.columns.get(columnBname).value, valueDname);
|
||||
closeScanner(scanner1, handler);
|
||||
|
||||
// Test a scanner on all rows and all columns, with timestamp
|
||||
@ -286,7 +290,7 @@ public class TestThriftServer extends HBaseClusterTestCase {
|
||||
assertEquals(rowResult2a.columns.size(), 1);
|
||||
// column A deleted, does not exist.
|
||||
//assertTrue(Bytes.equals(rowResult2a.columns.get(columnAname).value, valueAname));
|
||||
assertTrue(Bytes.equals(rowResult2a.columns.get(columnBname).value, valueBname));
|
||||
assertEquals(rowResult2a.columns.get(columnBname).value, valueBname);
|
||||
closeScanner(scanner2, handler);
|
||||
|
||||
// Test a scanner on the first row and first column only, no timestamp
|
||||
@ -299,7 +303,7 @@ public class TestThriftServer extends HBaseClusterTestCase {
|
||||
getColumnList(false, true), time1);
|
||||
TRowResult rowResult4a = handler.scannerGet(scanner4).get(0);
|
||||
assertEquals(rowResult4a.columns.size(), 1);
|
||||
assertTrue(Bytes.equals(rowResult4a.columns.get(columnBname).value, valueBname));
|
||||
assertEquals(rowResult4a.columns.get(columnBname).value, valueBname);
|
||||
|
||||
// Teardown
|
||||
handler.disableTable(tableAname);
|
||||
@ -333,8 +337,8 @@ public class TestThriftServer extends HBaseClusterTestCase {
|
||||
* @param includeB whether or not to include columnB
|
||||
* @return a List of column names for use in retrieving a scanner
|
||||
*/
|
||||
private List<byte[]> getColumnList(boolean includeA, boolean includeB) {
|
||||
List<byte[]> columnList = new ArrayList<byte[]>();
|
||||
private List<ByteBuffer> getColumnList(boolean includeA, boolean includeB) {
|
||||
List<ByteBuffer> columnList = new ArrayList<ByteBuffer>();
|
||||
if (includeA) columnList.add(columnAname);
|
||||
if (includeB) columnList.add(columnBname);
|
||||
return columnList;
|
||||
|
Loading…
x
Reference in New Issue
Block a user