Refine search
public ResultScanner scan(byte[] startRow, byte[] stopRow) throws Exception { try { if (startRow == null) { startRow = HConstants.EMPTY_START_ROW; } if (stopRow == null) { stopRow = HConstants.EMPTY_END_ROW; } Scan scan = new Scan(startRow, stopRow); return table.getScanner(scan); } catch (Exception e) { LOG.warn("Could not open HBASE scanner.", e); throw e; } }
/** * The underlying {@link HTable} must not be closed. * {@link Table#getScanner(byte[], byte[])} has other usage details. */ @Override public ResultScanner getScanner(byte [] family, byte [] qualifier) throws IOException { Scan scan = new Scan(); scan.addColumn(family, qualifier); return getScanner(scan); }
/** * The underlying {@link HTable} must not be closed. * {@link Table#getScanner(byte[])} has other usage details. */ @Override public ResultScanner getScanner(byte [] family) throws IOException { Scan scan = new Scan(); scan.addFamily(family); return getScanner(scan); }
@Override public Map<String, Object> count(String task) { MappingConfig config = hbaseMapping.get(task); String hbaseTable = config.getHbaseMapping().getHbaseTable(); long rowCount = 0L; try { HTable table = (HTable) hbaseTemplate.getConnection().getTable(TableName.valueOf(hbaseTable)); Scan scan = new Scan(); scan.setFilter(new FirstKeyOnlyFilter()); ResultScanner resultScanner = table.getScanner(scan); for (Result result : resultScanner) { rowCount += result.size(); } } catch (IOException e) { logger.error(e.getMessage(), e); } Map<String, Object> res = new LinkedHashMap<>(); res.put("hbaseTable", hbaseTable); res.put("count", rowCount); return res; }
@Override public Iterable<String> getAllKeys() { Scan scan = new Scan(); resultIterator = htable().getScanner(scan).iterator(); } catch (IOException e) { throw new RuntimeException(e);
table = new HTable(adm.getConfiguration(), tableName); Scan scan = new Scan(); scan.setBatch(100); scan.setCacheBlocks(false); scanner = table.getScanner(scan);
table = new HTable(adm.getConfiguration(), tableName); Scan scan = new Scan(); scan.setBatch(100); scan.setCacheBlocks(false); scanner = table.getScanner(scan);
table = new HTable(adm.getConfiguration(), tableName); Scan scan = new Scan(); scan.setBatch(100); scan.setCacheBlocks(false); scanner = table.getScanner(scan);
/** * The underlying {@link HTable} must not be closed. * {@link Table#getScanner(byte[], byte[])} has other usage details. */ @Override public ResultScanner getScanner(byte [] family, byte [] qualifier) throws IOException { Scan scan = new Scan(); scan.addColumn(family, qualifier); return getScanner(scan); }
/** * The underlying {@link HTable} must not be closed. * {@link Table#getScanner(byte[])} has other usage details. */ @Override public ResultScanner getScanner(byte [] family) throws IOException { Scan scan = new Scan(); scan.addFamily(family); return getScanner(scan); }
table.put(put); Scan scan = new Scan(); ResultScanner scanner = table.getScanner(scan); for (Result result2 : scanner) { System.out.println("Scan 1: " + result2); table.delete(delete); Scan scan2 = new Scan(); ResultScanner scanner2 = table.getScanner(scan2); for (Result result2 : scanner2) { System.out.println("Scan2: " + result2);
private int getKeyValueCount(HTable table) throws IOException { Scan scan = new Scan(); scan.setMaxVersions(Integer.MAX_VALUE - 1); ResultScanner results = table.getScanner(scan); int count = 0; for (Result res : results) { count += res.list().size(); System.out.println(count + ") " + res); } results.close(); return count; } }
/** * Verify the state of the index table between the given key and time ranges against the list of * expected keyvalues. * @throws IOException */ @SuppressWarnings("javadoc") public static void verifyIndexTableAtTimestamp(HTable index1, List<KeyValue> expected, long start, long end, byte[] startKey, byte[] endKey) throws IOException { LOG.debug("Scanning " + Bytes.toString(index1.getTableName()) + " between times (" + start + ", " + end + "] and keys: [" + Bytes.toString(startKey) + ", " + Bytes.toString(endKey) + "]."); Scan s = new Scan(startKey, endKey); // s.setRaw(true); s.setMaxVersions(); s.setTimeRange(start, end); List<KeyValue> received = new ArrayList<KeyValue>(); ResultScanner scanner = index1.getScanner(s); for (Result r : scanner) { received.addAll(r.list()); LOG.debug("Received: " + r.list()); } scanner.close(); assertEquals("Didn't get the expected kvs from the index table!", expected, received); }
ResultScanner resultScanner = table.getScanner(new Scan()); for (Result result : resultScanner) { System.out.println(result);
Scan s = new Scan(); s.setRaw(true); ResultScanner scanner = index.getScanner(s); for (Result r : scanner) { LOG.debug("Found row:" + r); Scan s = new Scan(); s.setRaw(true); ResultScanner scanner = index.getScanner(s); for (Result r : scanner) { LOG.debug("Found row:" + r);
Scan s = new Scan(); s.setRaw(true); ResultScanner scanner = index1.getScanner(s); for (Result r : scanner) { LOG.debug("Found row:" + r);
Scan scan = new Scan(); HTable table = (HTable) conn.unwrap(PhoenixConnection.class).getQueryServices().getTable(viewIndexPhysicalTable); ResultScanner results = table.getScanner(scan); Result result = results.next(); assertNotNull(result);
Scan s = new Scan(); HTable index = new HTable(conf, getIndexTableName()); ResultScanner scanner = index.getScanner(s); int count = 0; for (Result r : scanner) {
/** * The underlying {@link HTable} must not be closed. * {@link Table#getScanner(byte[])} has other usage details. */ @Override public ResultScanner getScanner(byte [] family) throws IOException { Scan scan = new Scan(); scan.addFamily(family); return getScanner(scan); }
/** * The underlying {@link HTable} must not be closed. * {@link Table#getScanner(byte[], byte[])} has other usage details. */ @Override public ResultScanner getScanner(byte [] family, byte [] qualifier) throws IOException { Scan scan = new Scan(); scan.addColumn(family, qualifier); return getScanner(scan); }