本文整理了Java中org.apache.hadoop.hbase.Cell.getValue()
方法的一些代码示例,展示了Cell.getValue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Cell.getValue()
方法的具体详情如下:
包路径:org.apache.hadoop.hbase.Cell
类名称:Cell
方法名:getValue
[英]WARNING do not use, expensive. This gets an arraycopy of the cell's value. Added to ease transition from 0.94 -> 0.96.
[中]警告不要使用,价格昂贵。这将获取单元格值的arraycopy。添加以简化从0.94->0.96的转换。
代码示例来源:origin: harbby/presto-connectors
@Override
@Deprecated
public byte[] getValue() {
return cell.getValue();
}
代码示例来源:origin: stackoverflow.com
static synchronized void swapValues(Cell c1, Cell c2) {
int t = c1.getValue();
System.out.println("Swapping " + t);
int v = c2.getValue();
System.out.println("with " + v);
c1.setValue(v);
c2.setValue(t);
System.out.println("Cell is now " + c1.getValue());
System.out.println("Cell was " + c2.getValue());
}
代码示例来源:origin: stackoverflow.com
Iterator sheetInterator = new Itertor();
Set<Object> set = new HashSet();
while(sheetInterator.hasNext()) {
Row myrow = (Row) obj.next();
Iterator rowIterator = myrow.iterator();
while(rowIterator.hasNext()) {
Cell cell = (Cell) rowIterator.next();
String value = cell.getValue();
if(!set.add(value)){
// value has not been added to the set -> it is at least 2nd occurrence of this value
}
}
}
代码示例来源:origin: harbby/presto-connectors
/**
* Deserialized and returns a CompactionDescriptor is the KeyValue contains one.
* @param kv the key value
* @return deserialized CompactionDescriptor or null.
*/
public static CompactionDescriptor getCompaction(Cell kv) throws IOException {
if (CellUtil.matchingColumn(kv, METAFAMILY, COMPACTION)) {
return CompactionDescriptor.parseFrom(kv.getValue());
}
return null;
}
代码示例来源:origin: harbby/presto-connectors
public static FlushDescriptor getFlushDescriptor(Cell cell) throws IOException {
if (CellUtil.matchingColumn(cell, METAFAMILY, FLUSH)) {
return FlushDescriptor.parseFrom(cell.getValue());
}
return null;
}
代码示例来源:origin: harbby/presto-connectors
public static RegionEventDescriptor getRegionEventDescriptor(Cell cell) throws IOException {
if (CellUtil.matchingColumn(cell, METAFAMILY, REGION_EVENT)) {
return RegionEventDescriptor.parseFrom(cell.getValue());
}
return null;
}
代码示例来源:origin: harbby/presto-connectors
/**
* Deserialized and returns a BulkLoadDescriptor from the passed in Cell
* @param cell the key value
* @return deserialized BulkLoadDescriptor or null.
*/
public static WALProtos.BulkLoadDescriptor getBulkLoadDescriptor(Cell cell) throws IOException {
if (CellUtil.matchingColumn(cell, METAFAMILY, BULK_LOAD)) {
return WALProtos.BulkLoadDescriptor.parseFrom(cell.getValue());
}
return null;
}
}
代码示例来源:origin: cdapio/cdap
private void verifyCounts(HRegion region, Scan scan, long[] counts, int batch) throws Exception {
RegionScanner scanner = new IncrementSummingScanner(region, batch, region.getScanner(scan), ScanType.USER_SCAN);
// init with false if loop will execute zero times
boolean hasMore = counts.length > 0;
for (long count : counts) {
List<Cell> results = Lists.newArrayList();
hasMore = scanner.next(results);
assertEquals(1, results.size());
Cell cell = results.get(0);
assertNotNull(cell);
assertEquals(count, Bytes.toLong(cell.getValue()));
}
assertFalse(hasMore);
}
代码示例来源:origin: cdapio/cdap
private void verifyCounts(HRegion region, Scan scan, long[] counts, int batch) throws Exception {
RegionScanner scanner = new IncrementSummingScanner(region, batch, region.getScanner(scan), ScanType.USER_SCAN);
// init with false if loop will execute zero times
boolean hasMore = counts.length > 0;
for (long count : counts) {
List<Cell> results = Lists.newArrayList();
hasMore = scanner.next(results);
assertEquals(1, results.size());
Cell cell = results.get(0);
assertNotNull(cell);
assertEquals(count, Bytes.toLong(cell.getValue()));
}
assertFalse(hasMore);
}
代码示例来源:origin: caskdata/cdap
private void verifyCounts(HRegion region, Scan scan, long[] counts, int batch) throws Exception {
RegionScanner scanner = new IncrementSummingScanner(region, batch, region.getScanner(scan), ScanType.USER_SCAN);
// init with false if loop will execute zero times
boolean hasMore = counts.length > 0;
for (long count : counts) {
List<Cell> results = Lists.newArrayList();
hasMore = scanner.next(results);
assertEquals(1, results.size());
Cell cell = results.get(0);
assertNotNull(cell);
assertEquals(count, Bytes.toLong(cell.getValue()));
}
assertFalse(hasMore);
}
代码示例来源:origin: cdapio/cdap
private void verifyCounts(HRegion region, Scan scan, long[] counts, int batch) throws Exception {
RegionScanner scanner = new IncrementSummingScanner(region, batch, region.getScanner(scan), ScanType.USER_SCAN);
// init with false if loop will execute zero times
boolean hasMore = counts.length > 0;
for (long count : counts) {
List<Cell> results = Lists.newArrayList();
hasMore = scanner.next(results);
assertEquals(1, results.size());
Cell cell = results.get(0);
assertNotNull(cell);
assertEquals(count, Bytes.toLong(cell.getValue()));
}
assertFalse(hasMore);
}
代码示例来源:origin: cdapio/cdap
private void verifyCounts(HRegion region, Scan scan, long[] counts, int batch) throws Exception {
RegionScanner scanner = new IncrementSummingScanner(region, batch, region.getScanner(scan), ScanType.USER_SCAN);
// init with false if loop will execute zero times
boolean hasMore = counts.length > 0;
for (long count : counts) {
List<Cell> results = Lists.newArrayList();
hasMore = scanner.next(results);
assertEquals(1, results.size());
Cell cell = results.get(0);
assertNotNull(cell);
assertEquals(count, Bytes.toLong(cell.getValue()));
}
assertFalse(hasMore);
}
代码示例来源:origin: cdapio/cdap
private void verifyCounts(HRegion region, Scan scan, long[] counts, int batch) throws Exception {
RegionScanner scanner = new IncrementSummingScanner(region, batch, region.getScanner(scan), ScanType.USER_SCAN);
// init with false if loop will execute zero times
boolean hasMore = counts.length > 0;
for (long count : counts) {
List<Cell> results = Lists.newArrayList();
hasMore = scanner.next(results);
assertEquals(1, results.size());
Cell cell = results.get(0);
assertNotNull(cell);
assertEquals(count, Bytes.toLong(cell.getValue()));
}
assertFalse(hasMore);
}
代码示例来源:origin: cdapio/cdap
private void verifyCounts(HRegion region, Scan scan, long[] counts, int batch) throws Exception {
RegionScanner scanner = new IncrementSummingScanner(region, batch, region.getScanner(scan), ScanType.USER_SCAN);
// init with false if loop will execute zero times
boolean hasMore = counts.length > 0;
for (long count : counts) {
List<Cell> results = Lists.newArrayList();
hasMore = scanner.next(results);
assertEquals(1, results.size());
Cell cell = results.get(0);
assertNotNull(cell);
assertEquals(count, Bytes.toLong(cell.getValue()));
}
assertFalse(hasMore);
}
代码示例来源:origin: cdapio/cdap
@Override
public void assertColumn(HTable table, byte[] row, byte[] col, long expected) throws Exception {
Result res = table.get(new Get(row));
Cell resA = res.getColumnLatestCell(FAMILY, col);
assertFalse(res.isEmpty());
assertNotNull(resA);
assertEquals(expected, Bytes.toLong(resA.getValue()));
Scan scan = new Scan(row);
scan.addFamily(FAMILY);
ResultScanner scanner = table.getScanner(scan);
Result scanRes = scanner.next();
assertNotNull(scanRes);
assertFalse(scanRes.isEmpty());
Cell scanResA = scanRes.getColumnLatestCell(FAMILY, col);
assertArrayEquals(row, scanResA.getRow());
assertEquals(expected, Bytes.toLong(scanResA.getValue()));
}
代码示例来源:origin: caskdata/cdap
@Override
public void assertColumn(HTable table, byte[] row, byte[] col, long expected) throws Exception {
Result res = table.get(new Get(row));
Cell resA = res.getColumnLatestCell(FAMILY, col);
assertFalse(res.isEmpty());
assertNotNull(resA);
assertEquals(expected, Bytes.toLong(resA.getValue()));
Scan scan = new Scan(row);
scan.addFamily(FAMILY);
ResultScanner scanner = table.getScanner(scan);
Result scanRes = scanner.next();
assertNotNull(scanRes);
assertFalse(scanRes.isEmpty());
Cell scanResA = scanRes.getColumnLatestCell(FAMILY, col);
assertArrayEquals(row, scanResA.getRow());
assertEquals(expected, Bytes.toLong(scanResA.getValue()));
}
代码示例来源:origin: cdapio/cdap
@Override
public void assertColumn(HTable table, byte[] row, byte[] col, long expected) throws Exception {
Result res = table.get(new Get(row));
Cell resA = res.getColumnLatestCell(FAMILY, col);
assertFalse(res.isEmpty());
assertNotNull(resA);
assertEquals(expected, Bytes.toLong(resA.getValue()));
Scan scan = new Scan(row);
scan.addFamily(FAMILY);
ResultScanner scanner = table.getScanner(scan);
Result scanRes = scanner.next();
assertNotNull(scanRes);
assertFalse(scanRes.isEmpty());
Cell scanResA = scanRes.getColumnLatestCell(FAMILY, col);
assertArrayEquals(row, scanResA.getRow());
assertEquals(expected, Bytes.toLong(scanResA.getValue()));
}
代码示例来源:origin: cdapio/cdap
@Override
public void assertColumn(HTable table, byte[] row, byte[] col, long expected) throws Exception {
Result res = table.get(new Get(row));
Cell resA = res.getColumnLatestCell(FAMILY, col);
assertFalse(res.isEmpty());
assertNotNull(resA);
assertEquals(expected, Bytes.toLong(resA.getValue()));
Scan scan = new Scan(row);
scan.addFamily(FAMILY);
ResultScanner scanner = table.getScanner(scan);
Result scanRes = scanner.next();
assertNotNull(scanRes);
assertFalse(scanRes.isEmpty());
Cell scanResA = scanRes.getColumnLatestCell(FAMILY, col);
assertArrayEquals(row, scanResA.getRow());
assertEquals(expected, Bytes.toLong(scanResA.getValue()));
}
代码示例来源:origin: cdapio/cdap
@Override
public void assertColumn(HTable table, byte[] row, byte[] col, long expected) throws Exception {
Result res = table.get(new Get(row));
Cell resA = res.getColumnLatestCell(FAMILY, col);
assertFalse(res.isEmpty());
assertNotNull(resA);
assertEquals(expected, Bytes.toLong(resA.getValue()));
Scan scan = new Scan(row);
scan.addFamily(FAMILY);
ResultScanner scanner = table.getScanner(scan);
Result scanRes = scanner.next();
assertNotNull(scanRes);
assertFalse(scanRes.isEmpty());
Cell scanResA = scanRes.getColumnLatestCell(FAMILY, col);
assertArrayEquals(row, scanResA.getRow());
assertEquals(expected, Bytes.toLong(scanResA.getValue()));
}
代码示例来源:origin: cdapio/cdap
@Override
public void assertColumn(HTable table, byte[] row, byte[] col, long expected) throws Exception {
Result res = table.get(new Get(row));
Cell resA = res.getColumnLatestCell(FAMILY, col);
assertFalse(res.isEmpty());
assertNotNull(resA);
assertEquals(expected, Bytes.toLong(resA.getValue()));
Scan scan = new Scan(row);
scan.addFamily(FAMILY);
ResultScanner scanner = table.getScanner(scan);
Result scanRes = scanner.next();
assertNotNull(scanRes);
assertFalse(scanRes.isEmpty());
Cell scanResA = scanRes.getColumnLatestCell(FAMILY, col);
assertArrayEquals(row, scanResA.getRow());
assertEquals(expected, Bytes.toLong(scanResA.getValue()));
}
内容来源于网络,如有侵权,请联系作者删除!