/** * Set the end key in the range to scan. * * @param key the end key to scan until (exclusive). * * @return this {@link RowScanner} to facilitate method chaining. * * @see org.hbase.async.Scanner#setStopKey(byte[]) */ public RowScanner setStopKey(final String key) { scanner.setStopKey(key); return this; }
/** * Set the end key in the range to scan. * * @param key the end key to scan until (exclusive) * * @return this {@link RowScanner} to facilitate method chaining. * * @see org.hbase.async.Scanner#setStopKey(byte[]) */ public RowScanner setStopKey(final byte[] key) { scanner.setStopKey(key); return this; }
/** * Specifies up to which row key to scan (exclusive). * @see #setStopKey(byte[]) * @throws IllegalStateException if scanning already started. */ public void setStopKey(final String stop_key) { setStopKey(stop_key.getBytes()); }
/** * Creates a scanner that scans the right range of rows for suggestions. */ private Scanner getSuggestScanner(final String search) { final byte[] start_row; final byte[] end_row; if (search.isEmpty()) { start_row = START_ROW; end_row = END_ROW; } else { start_row = toBytes(search); end_row = Arrays.copyOf(start_row, start_row.length); end_row[start_row.length - 1]++; } final Scanner scanner = client.newScanner(table); scanner.setStartKey(start_row); scanner.setStopKey(end_row); scanner.setFamily(ID_FAMILY); scanner.setQualifier(kind); scanner.setMaxNumRows(MAX_SUGGESTIONS); return scanner; }
private ArrayList<ArrayList<KeyValue>> _getSingleRow(final String start, final String end, final FilterList filterList, final String tableName) { final Scanner scanner = _client.newScanner(tableName); scanner.setStartKey(start); scanner.setStopKey(end); scanner.setMaxNumRows(1); scanner.setFilter(filterList); _logger.debug("Using table: " + tableName); _logger.debug("Scan startRow: " + start); _logger.debug("Scan stopRow: " + end); Deferred<ArrayList<ArrayList<KeyValue>>> deferred = scanner.nextRows(); deferred.addCallback(new Callback<ArrayList<ArrayList<KeyValue>>, ArrayList<ArrayList<KeyValue>>>() { @Override public ArrayList<ArrayList<KeyValue>> call(ArrayList<ArrayList<KeyValue>> rows) throws Exception { scanner.close(); return rows; } }); try { ArrayList<ArrayList<KeyValue>> result = deferred.join(SCAN_TIMEOUT_MS); return result; } catch (InterruptedException e) { throw new SystemException("Interrupted while waiting to obtain results for query", e); } catch (TimeoutException e) { _logger.warn("Timed out while waiting to obtain results."); } catch (Exception e) { throw new SystemException("Exception occurred in getting results for query", e); } return null; }
private ArrayList<ArrayList<KeyValue>> _getSingleRow(final String start, final String end, final FilterList filterList, final String tableName) { final Scanner scanner = _client.newScanner(tableName); scanner.setStartKey(start); scanner.setStopKey(end); scanner.setMaxNumRows(1); scanner.setFilter(filterList); _logger.debug("Using table: " + tableName); _logger.debug("Scan startRow: " + start); _logger.debug("Scan stopRow: " + end); Deferred<ArrayList<ArrayList<KeyValue>>> deferred = scanner.nextRows(); deferred.addCallback(new Callback<ArrayList<ArrayList<KeyValue>>, ArrayList<ArrayList<KeyValue>>>() { @Override public ArrayList<ArrayList<KeyValue>> call(ArrayList<ArrayList<KeyValue>> rows) throws Exception { scanner.close(); return rows; } }); try { ArrayList<ArrayList<KeyValue>> result = deferred.join(SCAN_TIMEOUT_MS); return result; } catch (InterruptedException e) { throw new SystemException("Interrupted while waiting to obtain results for query", e); } catch (TimeoutException e) { _logger.warn("Timed out while waiting to obtain results."); } catch (Exception e) { throw new SystemException("Exception occurred in getting results for query", e); } return null; }
String stopRow = HBaseUtils._plusOne(startRow); scanner.setStartKey(startRow); scanner.setStopKey(stopRow); scanner.setMaxNumRows(Math.min(limit, MAX_NUM_ROWS)); scanner.setFilter(filter);
String stopRow = HBaseUtils._plusOne(startRow); scanner.setStartKey(startRow); scanner.setStopKey(stopRow); scanner.setMaxNumRows(Math.min(limit, MAX_NUM_ROWS)); scanner.setFilter(filter);
String stopRow = HBaseUtils._plusOne(startRow); scanner.setStartKey(startRow); scanner.setStopKey(stopRow); scanner.setMaxNumRows(Math.min(limit, MAX_NUM_ROWS)); scanner.setFilter(filter);
String stopRow = HBaseUtils._plusOne(startRow); scanner.setStartKey(startRow); scanner.setStopKey(stopRow); scanner.setMaxNumRows(Math.min(limit, MAX_NUM_ROWS)); scanner.setFilter(filter);
/** * Creates the {@link org.hbase.async.Scanner} to use for this query. */ Scanner getScanner() throws HBaseException { final short metric_width = tsdb.metrics.width(); final byte[] start_row = new byte[metric_width + Const.TIMESTAMP_BYTES]; final byte[] end_row = new byte[metric_width + Const.TIMESTAMP_BYTES]; // We search at least one row before and one row after the start & end // time we've been given as it's quite likely that the exact timestamp // we're looking for is in the middle of a row. Plus, a number of things // rely on having a few extra data points before & after the exact start // & end dates in order to do proper rate calculation or downsampling near // the "edges" of the graph. Bytes.setInt(start_row, (int) getScanStartTime(), metric_width); Bytes.setInt(end_row, (end_time == UNSET ? -1 // Will scan until the end (0xFFF...). : (int) getScanEndTime()), metric_width ); System.arraycopy(metric, 0, start_row, 0, metric_width); System.arraycopy(metric, 0, end_row, 0, metric_width); final Scanner scanner = tsdb.client.newScanner(tsdb.table); scanner.setStartKey(start_row); scanner.setStopKey(end_row); if (tags.size() > 0 || group_bys != null) { createAndSetFilter(scanner); } scanner.setFamily(TSDB.FAMILY); return scanner; }
scanner.setStopKey(metadata.stopRow); scanner.setFilter(filterList); scanner.setMaxNumRows(10000);
scanner.setStopKey(metadata.stopRow); scanner.setFilter(fl); scanner.setMaxNumRows(Math.min(query.getLimit(), 10000));
scanner.setStopKey(metadata.stopRow); scanner.setFilter(fl); scanner.setMaxNumRows(Math.min(query.getLimit(), 10000));
scanner.setStopKey(metadata.stopRow); scanner.setFilter(filterList); scanner.setMaxNumRows(10000);
has_root && !split_meta ? META : HBASE96_META); meta_scanner.setStartKey(meta_start); meta_scanner.setStopKey(meta_stop);