@Override @Deprecated public byte[] getValue() { return cell.getValue(); }
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()); }
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 } } }
/** * 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; }
public static FlushDescriptor getFlushDescriptor(Cell cell) throws IOException { if (CellUtil.matchingColumn(cell, METAFAMILY, FLUSH)) { return FlushDescriptor.parseFrom(cell.getValue()); } return null; }
public static RegionEventDescriptor getRegionEventDescriptor(Cell cell) throws IOException { if (CellUtil.matchingColumn(cell, METAFAMILY, REGION_EVENT)) { return RegionEventDescriptor.parseFrom(cell.getValue()); } return null; }
/** * 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; } }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
@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())); }
@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())); }
@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())); }
@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())); }
@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())); }
@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())); }