本文整理汇总了Java中org.apache.hadoop.hbase.thrift2.generated.TDelete类的典型用法代码示例。如果您正苦于以下问题:Java TDelete类的具体用法?Java TDelete怎么用?Java TDelete使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TDelete类属于org.apache.hadoop.hbase.thrift2.generated包,在下文中一共展示了TDelete类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: checkAndDelete
import org.apache.hadoop.hbase.thrift2.generated.TDelete; //导入依赖的package包/类
@Override
public boolean checkAndDelete(ByteBuffer table, ByteBuffer row, ByteBuffer family,
ByteBuffer qualifier, ByteBuffer value, TDelete deleteSingle) throws TIOError, TException {
Table htable = getTable(table);
try {
if (value == null) {
return htable.checkAndDelete(byteBufferToByteArray(row), byteBufferToByteArray(family),
byteBufferToByteArray(qualifier), null, deleteFromThrift(deleteSingle));
} else {
return htable.checkAndDelete(byteBufferToByteArray(row), byteBufferToByteArray(family),
byteBufferToByteArray(qualifier), byteBufferToByteArray(value),
deleteFromThrift(deleteSingle));
}
} catch (IOException e) {
throw getTIOError(e);
} finally {
closeTable(htable);
}
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:21,代码来源:ThriftHBaseServiceHandler.java
示例2: checkAndDelete
import org.apache.hadoop.hbase.thrift2.generated.TDelete; //导入依赖的package包/类
@Override
public boolean checkAndDelete(ByteBuffer table, ByteBuffer row, ByteBuffer family,
ByteBuffer qualifier, ByteBuffer value, TDelete deleteSingle) throws TIOError, TException {
HTableInterface htable = getTable(table);
try {
if (value == null) {
return htable.checkAndDelete(byteBufferToByteArray(row), byteBufferToByteArray(family),
byteBufferToByteArray(qualifier), null, deleteFromThrift(deleteSingle));
} else {
return htable.checkAndDelete(byteBufferToByteArray(row), byteBufferToByteArray(family),
byteBufferToByteArray(qualifier), byteBufferToByteArray(value),
deleteFromThrift(deleteSingle));
}
} catch (IOException e) {
throw getTIOError(e);
} finally {
closeTable(htable);
}
}
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:21,代码来源:ThriftHBaseServiceHandler.java
示例3: checkAndDelete
import org.apache.hadoop.hbase.thrift2.generated.TDelete; //导入依赖的package包/类
@Override
public boolean checkAndDelete(ByteBuffer table, ByteBuffer row, ByteBuffer family,
ByteBuffer qualifier, ByteBuffer value, TDelete deleteSingle) throws TIOError, TException {
checkReadOnlyMode();
Table htable = getTable(table);
try {
Table.CheckAndMutateBuilder mutateBuilder =
htable.checkAndMutate(byteBufferToByteArray(row), byteBufferToByteArray(family))
.qualifier(byteBufferToByteArray(qualifier));
if (value == null) {
return mutateBuilder.ifNotExists().thenDelete(deleteFromThrift(deleteSingle));
} else {
return mutateBuilder.ifEquals(byteBufferToByteArray(value))
.thenDelete(deleteFromThrift(deleteSingle));
}
} catch (IOException e) {
throw getTIOError(e);
} finally {
closeTable(htable);
}
}
开发者ID:apache,项目名称:hbase,代码行数:22,代码来源:ThriftHBaseServiceHandler.java
示例4: testDeleteWithReadOnly
import org.apache.hadoop.hbase.thrift2.generated.TDelete; //导入依赖的package包/类
@Test
public void testDeleteWithReadOnly() throws Exception {
ThriftHBaseServiceHandler handler = createHandler();
byte[] rowName = Bytes.toBytes("testDelete");
ByteBuffer table = wrap(tableAname);
TDelete delete = new TDelete(wrap(rowName));
boolean exceptionCaught = false;
try {
handler.deleteSingle(table, delete);
} catch (TIOError e) {
exceptionCaught = true;
assertTrue(e.getCause() instanceof DoNotRetryIOException);
assertEquals("Thrift Server is in Read-only mode.", e.getMessage());
} finally {
assertTrue(exceptionCaught);
}
}
开发者ID:apache,项目名称:hbase,代码行数:20,代码来源:TestThriftHBaseServiceHandlerWithReadOnly.java
示例5: testDeleteMultipleWithReadOnly
import org.apache.hadoop.hbase.thrift2.generated.TDelete; //导入依赖的package包/类
@Test
public void testDeleteMultipleWithReadOnly() throws Exception {
ThriftHBaseServiceHandler handler = createHandler();
ByteBuffer table = wrap(tableAname);
byte[] rowName1 = Bytes.toBytes("testDeleteMultiple1");
byte[] rowName2 = Bytes.toBytes("testDeleteMultiple2");
List<TDelete> deletes = new ArrayList<>(2);
deletes.add(new TDelete(wrap(rowName1)));
deletes.add(new TDelete(wrap(rowName2)));
boolean exceptionCaught = false;
try {
handler.deleteMultiple(table, deletes);
} catch (TIOError e) {
exceptionCaught = true;
assertTrue(e.getCause() instanceof DoNotRetryIOException);
assertEquals("Thrift Server is in Read-only mode.", e.getMessage());
} finally {
assertTrue(exceptionCaught);
}
}
开发者ID:apache,项目名称:hbase,代码行数:23,代码来源:TestThriftHBaseServiceHandlerWithReadOnly.java
示例6: testCheckAndDeleteWithReadOnly
import org.apache.hadoop.hbase.thrift2.generated.TDelete; //导入依赖的package包/类
@Test
public void testCheckAndDeleteWithReadOnly() throws Exception {
ThriftHBaseServiceHandler handler = createHandler();
byte[] rowName = Bytes.toBytes("testCheckAndDelete");
ByteBuffer table = wrap(tableAname);
TDelete delete = new TDelete(wrap(rowName));
boolean exceptionCaught = false;
try {
handler.checkAndDelete(table, wrap(rowName), wrap(familyAname),
wrap(qualifierAname), wrap(valueAname), delete);
} catch (TIOError e) {
exceptionCaught = true;
assertTrue(e.getCause() instanceof DoNotRetryIOException);
assertEquals("Thrift Server is in Read-only mode.", e.getMessage());
} finally {
assertTrue(exceptionCaught);
}
}
开发者ID:apache,项目名称:hbase,代码行数:21,代码来源:TestThriftHBaseServiceHandlerWithReadOnly.java
示例7: checkAndDelete
import org.apache.hadoop.hbase.thrift2.generated.TDelete; //导入依赖的package包/类
@Override
public boolean checkAndDelete(ByteBuffer table, ByteBuffer row, ByteBuffer family, ByteBuffer qualifier, ByteBuffer value,
TDelete deleteSingle) throws TIOError, TException {
HTableInterface htable = getTable(table.array());
try {
if (value == null) {
return htable.checkAndDelete(row.array(), family.array(), qualifier.array(), null, deleteFromThrift(deleteSingle));
} else {
return htable.checkAndDelete(row.array(), family.array(), qualifier.array(), value.array(), deleteFromThrift(deleteSingle));
}
} catch (IOException e) {
throw getTIOError(e);
} finally {
closeTable(htable);
}
}
开发者ID:zwqjsj0404,项目名称:HBase-Research,代码行数:18,代码来源:ThriftHBaseServiceHandler.java
示例8: deleteFromHBase
import org.apache.hadoop.hbase.thrift2.generated.TDelete; //导入依赖的package包/类
public static TDelete deleteFromHBase(Delete in) {
TDelete out = new TDelete(ByteBuffer.wrap(in.getRow()));
List<TColumn> columns = new ArrayList<TColumn>();
long rowTimestamp = in.getTimeStamp();
if (rowTimestamp != HConstants.LATEST_TIMESTAMP) {
out.setTimestamp(rowTimestamp);
}
// Map<family, List<KeyValue>>
for (Map.Entry<byte[], List<org.apache.hadoop.hbase.Cell>> familyEntry:
in.getFamilyCellMap().entrySet()) {
TColumn column = new TColumn(ByteBuffer.wrap(familyEntry.getKey()));
for (org.apache.hadoop.hbase.Cell cell: familyEntry.getValue()) {
byte[] family = CellUtil.cloneFamily(cell);
byte[] qualifier = CellUtil.cloneQualifier(cell);
long timestamp = cell.getTimestamp();
if (family != null) {
column.setFamily(family);
}
if (qualifier != null) {
column.setQualifier(qualifier);
}
if (timestamp != HConstants.LATEST_TIMESTAMP) {
column.setTimestamp(timestamp);
}
}
columns.add(column);
}
out.setColumns(columns);
return out;
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:34,代码来源:ThriftUtilities.java
示例9: deleteMultiple
import org.apache.hadoop.hbase.thrift2.generated.TDelete; //导入依赖的package包/类
@Override
public List<TDelete> deleteMultiple(ByteBuffer table, List<TDelete> deletes) throws TIOError,
TException {
Table htable = getTable(table);
try {
htable.delete(deletesFromThrift(deletes));
} catch (IOException e) {
throw getTIOError(e);
} finally {
closeTable(htable);
}
return Collections.emptyList();
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:14,代码来源:ThriftHBaseServiceHandler.java
示例10: testDeleteMultiple
import org.apache.hadoop.hbase.thrift2.generated.TDelete; //导入依赖的package包/类
@Test
public void testDeleteMultiple() throws Exception {
ThriftHBaseServiceHandler handler = createHandler();
ByteBuffer table = wrap(tableAname);
byte[] rowName1 = "testDeleteMultiple1".getBytes();
byte[] rowName2 = "testDeleteMultiple2".getBytes();
List<TColumnValue> columnValues = new ArrayList<TColumnValue>();
columnValues.add(new TColumnValue(wrap(familyAname), wrap(qualifierAname), wrap(valueAname)));
columnValues.add(new TColumnValue(wrap(familyBname), wrap(qualifierBname), wrap(valueBname)));
List<TPut> puts = new ArrayList<TPut>();
puts.add(new TPut(wrap(rowName1), columnValues));
puts.add(new TPut(wrap(rowName2), columnValues));
handler.putMultiple(table, puts);
List<TDelete> deletes = new ArrayList<TDelete>();
deletes.add(new TDelete(wrap(rowName1)));
deletes.add(new TDelete(wrap(rowName2)));
List<TDelete> deleteResults = handler.deleteMultiple(table, deletes);
// 0 means they were all successfully applies
assertEquals(0, deleteResults.size());
assertFalse(handler.exists(table, new TGet(wrap(rowName1))));
assertFalse(handler.exists(table, new TGet(wrap(rowName2))));
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:28,代码来源:TestThriftHBaseServiceHandler.java
示例11: testDelete
import org.apache.hadoop.hbase.thrift2.generated.TDelete; //导入依赖的package包/类
@Test
public void testDelete() throws Exception {
ThriftHBaseServiceHandler handler = createHandler();
byte[] rowName = "testDelete".getBytes();
ByteBuffer table = wrap(tableAname);
List<TColumnValue> columnValues = new ArrayList<TColumnValue>();
TColumnValue columnValueA = new TColumnValue(wrap(familyAname), wrap(qualifierAname),
wrap(valueAname));
TColumnValue columnValueB = new TColumnValue(wrap(familyBname), wrap(qualifierBname),
wrap(valueBname));
columnValues.add(columnValueA);
columnValues.add(columnValueB);
TPut put = new TPut(wrap(rowName), columnValues);
put.setColumnValues(columnValues);
handler.put(table, put);
TDelete delete = new TDelete(wrap(rowName));
List<TColumn> deleteColumns = new ArrayList<TColumn>();
TColumn deleteColumn = new TColumn(wrap(familyAname));
deleteColumn.setQualifier(qualifierAname);
deleteColumns.add(deleteColumn);
delete.setColumns(deleteColumns);
handler.deleteSingle(table, delete);
TGet get = new TGet(wrap(rowName));
TResult result = handler.get(table, get);
assertArrayEquals(rowName, result.getRow());
List<TColumnValue> returnedColumnValues = result.getColumnValues();
List<TColumnValue> expectedColumnValues = new ArrayList<TColumnValue>();
expectedColumnValues.add(columnValueB);
assertTColumnValuesEqual(expectedColumnValues, returnedColumnValues);
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:37,代码来源:TestThriftHBaseServiceHandler.java
示例12: deleteMultiple
import org.apache.hadoop.hbase.thrift2.generated.TDelete; //导入依赖的package包/类
@Override
public List<TDelete> deleteMultiple(ByteBuffer table, List<TDelete> deletes) throws TIOError,
TException {
HTableInterface htable = getTable(table);
List<Delete> tempDeletes = deletesFromThrift(deletes);
try {
htable.delete(tempDeletes);
} catch (IOException e) {
throw getTIOError(e);
} finally {
closeTable(htable);
}
return deletesFromHBase(tempDeletes);
}
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:15,代码来源:ThriftHBaseServiceHandler.java
示例13: deleteFromHBase
import org.apache.hadoop.hbase.thrift2.generated.TDelete; //导入依赖的package包/类
public static TDelete deleteFromHBase(Delete in) {
TDelete out = new TDelete(ByteBuffer.wrap(in.getRow()));
List<TColumn> columns = new ArrayList<TColumn>();
long rowTimestamp = in.getTimeStamp();
if (rowTimestamp != HConstants.LATEST_TIMESTAMP) {
out.setTimestamp(rowTimestamp);
}
// Map<family, List<KeyValue>>
for (Map.Entry<byte[], List<org.apache.hadoop.hbase.Cell>> familyEntry:
in.getFamilyCellMap().entrySet()) {
TColumn column = new TColumn(ByteBuffer.wrap(familyEntry.getKey()));
for (org.apache.hadoop.hbase.Cell cell: familyEntry.getValue()) {
KeyValue kv = KeyValueUtil.ensureKeyValue(cell);
byte[] family = kv.getFamily();
byte[] qualifier = kv.getQualifier();
long timestamp = kv.getTimestamp();
if (family != null) {
column.setFamily(family);
}
if (qualifier != null) {
column.setQualifier(qualifier);
}
if (timestamp != HConstants.LATEST_TIMESTAMP) {
column.setTimestamp(kv.getTimestamp());
}
}
columns.add(column);
}
out.setColumns(columns);
return out;
}
开发者ID:tenggyut,项目名称:HIndex,代码行数:35,代码来源:ThriftUtilities.java
示例14: deleteFromHBase
import org.apache.hadoop.hbase.thrift2.generated.TDelete; //导入依赖的package包/类
public static TDelete deleteFromHBase(Delete in) {
TDelete out = new TDelete(ByteBuffer.wrap(in.getRow()));
List<TColumn> columns = new ArrayList<>(in.getFamilyCellMap().entrySet().size());
long rowTimestamp = in.getTimeStamp();
if (rowTimestamp != HConstants.LATEST_TIMESTAMP) {
out.setTimestamp(rowTimestamp);
}
// Map<family, List<KeyValue>>
for (Map.Entry<byte[], List<org.apache.hadoop.hbase.Cell>> familyEntry:
in.getFamilyCellMap().entrySet()) {
TColumn column = new TColumn(ByteBuffer.wrap(familyEntry.getKey()));
for (org.apache.hadoop.hbase.Cell cell: familyEntry.getValue()) {
byte[] family = CellUtil.cloneFamily(cell);
byte[] qualifier = CellUtil.cloneQualifier(cell);
long timestamp = cell.getTimestamp();
if (family != null) {
column.setFamily(family);
}
if (qualifier != null) {
column.setQualifier(qualifier);
}
if (timestamp != HConstants.LATEST_TIMESTAMP) {
column.setTimestamp(timestamp);
}
}
columns.add(column);
}
out.setColumns(columns);
return out;
}
开发者ID:apache,项目名称:hbase,代码行数:34,代码来源:ThriftUtilities.java
示例15: deleteMultiple
import org.apache.hadoop.hbase.thrift2.generated.TDelete; //导入依赖的package包/类
@Override
public List<TDelete> deleteMultiple(ByteBuffer table, List<TDelete> deletes) throws TIOError,
TException {
checkReadOnlyMode();
Table htable = getTable(table);
try {
htable.delete(deletesFromThrift(deletes));
} catch (IOException e) {
throw getTIOError(e);
} finally {
closeTable(htable);
}
return Collections.emptyList();
}
开发者ID:apache,项目名称:hbase,代码行数:15,代码来源:ThriftHBaseServiceHandler.java
示例16: testMutateRowWithReadOnly
import org.apache.hadoop.hbase.thrift2.generated.TDelete; //导入依赖的package包/类
@Test
public void testMutateRowWithReadOnly() throws Exception {
ThriftHBaseServiceHandler handler = createHandler();
byte[] rowName = Bytes.toBytes("testMutateRow");
ByteBuffer table = wrap(tableAname);
List<TColumnValue> columnValuesA = new ArrayList<>(1);
TColumnValue columnValueA = new TColumnValue(wrap(familyAname), wrap(qualifierAname),
wrap(valueAname));
columnValuesA.add(columnValueA);
TPut putA = new TPut(wrap(rowName), columnValuesA);
putA.setColumnValues(columnValuesA);
TDelete delete = new TDelete(wrap(rowName));
List<TMutation> mutations = new ArrayList<>(2);
TMutation mutationA = TMutation.put(putA);
mutations.add(mutationA);
TMutation mutationB = TMutation.deleteSingle(delete);
mutations.add(mutationB);
TRowMutations tRowMutations = new TRowMutations(wrap(rowName),mutations);
boolean exceptionCaught = false;
try {
handler.mutateRow(table,tRowMutations);
} catch (TIOError e) {
exceptionCaught = true;
assertTrue(e.getCause() instanceof DoNotRetryIOException);
assertEquals("Thrift Server is in Read-only mode.", e.getMessage());
} finally {
assertTrue(exceptionCaught);
}
}
开发者ID:apache,项目名称:hbase,代码行数:34,代码来源:TestThriftHBaseServiceHandlerWithReadOnly.java
示例17: testDeleteMultiple
import org.apache.hadoop.hbase.thrift2.generated.TDelete; //导入依赖的package包/类
@Test
public void testDeleteMultiple() throws Exception {
ThriftHBaseServiceHandler handler = createHandler();
ByteBuffer table = wrap(tableAname);
byte[] rowName1 = Bytes.toBytes("testDeleteMultiple1");
byte[] rowName2 = Bytes.toBytes("testDeleteMultiple2");
List<TColumnValue> columnValues = new ArrayList<>(2);
columnValues.add(new TColumnValue(wrap(familyAname), wrap(qualifierAname), wrap(valueAname)));
columnValues.add(new TColumnValue(wrap(familyBname), wrap(qualifierBname), wrap(valueBname)));
List<TPut> puts = new ArrayList<>(2);
puts.add(new TPut(wrap(rowName1), columnValues));
puts.add(new TPut(wrap(rowName2), columnValues));
handler.putMultiple(table, puts);
List<TDelete> deletes = new ArrayList<>(2);
deletes.add(new TDelete(wrap(rowName1)));
deletes.add(new TDelete(wrap(rowName2)));
List<TDelete> deleteResults = handler.deleteMultiple(table, deletes);
// 0 means they were all successfully applies
assertEquals(0, deleteResults.size());
assertFalse(handler.exists(table, new TGet(wrap(rowName1))));
assertFalse(handler.exists(table, new TGet(wrap(rowName2))));
}
开发者ID:apache,项目名称:hbase,代码行数:28,代码来源:TestThriftHBaseServiceHandler.java
示例18: testDelete
import org.apache.hadoop.hbase.thrift2.generated.TDelete; //导入依赖的package包/类
@Test
public void testDelete() throws Exception {
ThriftHBaseServiceHandler handler = createHandler();
byte[] rowName = Bytes.toBytes("testDelete");
ByteBuffer table = wrap(tableAname);
List<TColumnValue> columnValues = new ArrayList<>(2);
TColumnValue columnValueA = new TColumnValue(wrap(familyAname), wrap(qualifierAname),
wrap(valueAname));
TColumnValue columnValueB = new TColumnValue(wrap(familyBname), wrap(qualifierBname),
wrap(valueBname));
columnValues.add(columnValueA);
columnValues.add(columnValueB);
TPut put = new TPut(wrap(rowName), columnValues);
put.setColumnValues(columnValues);
handler.put(table, put);
TDelete delete = new TDelete(wrap(rowName));
List<TColumn> deleteColumns = new ArrayList<>(1);
TColumn deleteColumn = new TColumn(wrap(familyAname));
deleteColumn.setQualifier(qualifierAname);
deleteColumns.add(deleteColumn);
delete.setColumns(deleteColumns);
handler.deleteSingle(table, delete);
TGet get = new TGet(wrap(rowName));
TResult result = handler.get(table, get);
assertArrayEquals(rowName, result.getRow());
List<TColumnValue> returnedColumnValues = result.getColumnValues();
List<TColumnValue> expectedColumnValues = new ArrayList<>(1);
expectedColumnValues.add(columnValueB);
assertTColumnValuesEqual(expectedColumnValues, returnedColumnValues);
}
开发者ID:apache,项目名称:hbase,代码行数:37,代码来源:TestThriftHBaseServiceHandler.java
示例19: deleteMultiple
import org.apache.hadoop.hbase.thrift2.generated.TDelete; //导入依赖的package包/类
@Override
public List<TDelete> deleteMultiple(ByteBuffer table, List<TDelete> deletes) throws TIOError, TException {
HTableInterface htable = getTable(table.array());
List<Delete> tempDeletes = deletesFromThrift(deletes);
try {
htable.delete(tempDeletes);
} catch (IOException e) {
throw getTIOError(e);
} finally {
closeTable(htable);
}
return deletesFromHBase(tempDeletes);
}
开发者ID:zwqjsj0404,项目名称:HBase-Research,代码行数:14,代码来源:ThriftHBaseServiceHandler.java
示例20: testDeleteMultiple
import org.apache.hadoop.hbase.thrift2.generated.TDelete; //导入依赖的package包/类
@Test
public void testDeleteMultiple() throws Exception {
ThriftHBaseServiceHandler handler = createHandler();
ByteBuffer table = ByteBuffer.wrap(tableAname);
byte[] rowName1 = "testDeleteMultiple1".getBytes();
byte[] rowName2 = "testDeleteMultiple2".getBytes();
List<TColumnValue> columnValues = new ArrayList<TColumnValue>();
columnValues.add(new TColumnValue(ByteBuffer.wrap(familyAname), ByteBuffer.wrap(qualifierAname), ByteBuffer
.wrap(valueAname)));
columnValues.add(new TColumnValue(ByteBuffer.wrap(familyBname), ByteBuffer.wrap(qualifierBname), ByteBuffer
.wrap(valueBname)));
List<TPut> puts = new ArrayList<TPut>();
puts.add(new TPut(ByteBuffer.wrap(rowName1), columnValues));
puts.add(new TPut(ByteBuffer.wrap(rowName2), columnValues));
handler.putMultiple(table, puts);
List<TDelete> deletes = new ArrayList<TDelete>();
deletes.add(new TDelete(ByteBuffer.wrap(rowName1)));
deletes.add(new TDelete(ByteBuffer.wrap(rowName2)));
List<TDelete> deleteResults = handler.deleteMultiple(table, deletes);
// 0 means they were all successfully applies
assertEquals(0, deleteResults.size());
assertFalse(handler.exists(table, new TGet(ByteBuffer.wrap(rowName1))));
assertFalse(handler.exists(table, new TGet(ByteBuffer.wrap(rowName2))));
}
开发者ID:zwqjsj0404,项目名称:HBase-Research,代码行数:30,代码来源:TestThriftHBaseServiceHandler.java
注:本文中的org.apache.hadoop.hbase.thrift2.generated.TDelete类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论