Codota Logo
Scanner.setRange
Code IndexAdd Codota to your IDE (free)

How to use
setRange
method
in
org.apache.accumulo.core.client.Scanner

Best Java code snippets using org.apache.accumulo.core.client.Scanner.setRange (Showing top 20 results out of 486)

Refine searchRefine arrow

  • Connector.createScanner
  • Map.Entry.getKey
  • Common ways to obtain Scanner
private void myMethod () {
Scanner s =
  • Codota IconConnector connector;String tableName;Authorizations authorizations;connector.createScanner(tableName, authorizations)
  • Codota IconConnector connector;String tableName;connector.createScanner(tableName, new Authorizations())
  • Codota IconConnector connector;String str;Collection collection;ScannerHelper.createScanner(connector, str, collection)
  • Smart code suggestions by Codota
}
origin: brianfrankcooper/YCSB

/**
 * Gets a scanner from Accumulo over one row.
 *
 * @param row the row to scan
 * @param fields the set of columns to scan
 * @return an Accumulo {@link Scanner} bound to the given row and columns
 */
private Scanner getRow(String table, Text row, Set<String> fields) throws TableNotFoundException {
 Scanner scanner = connector.createScanner(table, Authorizations.EMPTY);
 scanner.setRange(new Range(row));
 if (fields != null) {
  for (String field : fields) {
   scanner.fetchColumn(colFam, new Text(field));
  }
 }
 return scanner;
}
origin: apache/accumulo

protected int removeReplicationEntries(Map<UUID,TServerInstance> candidates) {
 try {
  try {
   final Scanner s = ReplicationTable.getScanner(context);
   StatusSection.limit(s);
   for (Entry<Key,Value> entry : s) {
    UUID id = path2uuid(new Path(entry.getKey().getRow().toString()));
    candidates.remove(id);
    log.info("Ignore closed log " + id + " because it is being replicated");
   }
  } catch (ReplicationTableOfflineException ex) {
   return candidates.size();
  }
  final Scanner scanner = context.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
  scanner.fetchColumnFamily(MetadataSchema.ReplicationSection.COLF);
  scanner.setRange(MetadataSchema.ReplicationSection.getRange());
  for (Entry<Key,Value> entry : scanner) {
   Text file = new Text();
   MetadataSchema.ReplicationSection.getFile(entry.getKey(), file);
   UUID id = path2uuid(new Path(file.toString()));
   candidates.remove(id);
   log.info("Ignore closed log " + id + " because it is being replicated");
  }
  return candidates.size();
 } catch (TableNotFoundException e) {
  log.error("Failed to scan metadata table", e);
  throw new IllegalArgumentException(e);
 }
}
origin: brianfrankcooper/YCSB

/**
 * Gets a scanner from Accumulo over one row.
 *
 * @param row the row to scan
 * @param fields the set of columns to scan
 * @return an Accumulo {@link Scanner} bound to the given row and columns
 */
private Scanner getRow(String table, Text row, Set<String> fields) throws TableNotFoundException {
 Scanner scanner = connector.createScanner(table, Authorizations.EMPTY);
 scanner.setRange(new Range(row));
 if (fields != null) {
  for (String field : fields) {
   scanner.fetchColumn(colFam, new Text(field));
  }
 }
 return scanner;
}
origin: apache/accumulo

/**
 * During an upgrade we need to move deletion requests for files under the !METADATA table to the
 * root tablet.
 */
public static void moveMetaDeleteMarkers(ServerContext context) {
 String oldDeletesPrefix = "!!~del";
 Range oldDeletesRange = new Range(oldDeletesPrefix, true, "!!~dem", false);
 // move old delete markers to new location, to standardize table schema between all metadata
 // tables
 try (Scanner scanner = new ScannerImpl(context, RootTable.ID, Authorizations.EMPTY)) {
  scanner.setRange(oldDeletesRange);
  for (Entry<Key,Value> entry : scanner) {
   String row = entry.getKey().getRow().toString();
   if (row.startsWith(oldDeletesPrefix)) {
    moveDeleteEntry(context, RootTable.OLD_EXTENT, entry, row, oldDeletesPrefix);
   } else {
    break;
   }
  }
 }
}
origin: brianfrankcooper/YCSB

/**
 * Gets a scanner from Accumulo over one row.
 *
 * @param row the row to scan
 * @param fields the set of columns to scan
 * @return an Accumulo {@link Scanner} bound to the given row and columns
 */
private Scanner getRow(String table, Text row, Set<String> fields) throws TableNotFoundException {
 Scanner scanner = connector.createScanner(table, Authorizations.EMPTY);
 scanner.setRange(new Range(row));
 if (fields != null) {
  for (String field : fields) {
   scanner.fetchColumn(colFam, new Text(field));
  }
 }
 return scanner;
}
origin: apache/accumulo

public static Map<Long,? extends Collection<FileRef>> getBulkFilesLoaded(ServerContext context,
  KeyExtent extent) {
 Text metadataRow = extent.getMetadataEntry();
 Map<Long,List<FileRef>> result = new HashMap<>();
 VolumeManager fs = context.getVolumeManager();
 try (Scanner scanner = new ScannerImpl(context,
   extent.isMeta() ? RootTable.ID : MetadataTable.ID, Authorizations.EMPTY)) {
  scanner.setRange(new Range(metadataRow));
  scanner.fetchColumnFamily(TabletsSection.BulkFileColumnFamily.NAME);
  for (Entry<Key,Value> entry : scanner) {
   Long tid = Long.parseLong(entry.getValue().toString());
   List<FileRef> lst = result.get(tid);
   if (lst == null) {
    result.put(tid, lst = new ArrayList<>());
   }
   lst.add(new FileRef(fs, entry.getKey()));
  }
 }
 return result;
}
origin: prestodb/presto

public static Pair<byte[], byte[]> getMinMaxRowIds(Connector connector, AccumuloTable table, Authorizations auths)
    throws TableNotFoundException
{
  Scanner scanner = connector.createScanner(table.getMetricsTableName(), auths);
  scanner.setRange(new Range(new Text(Indexer.METRICS_TABLE_ROW_ID.array())));
  Text family = new Text(Indexer.METRICS_TABLE_ROWS_CF.array());
  Text firstRowQualifier = new Text(Indexer.METRICS_TABLE_FIRST_ROW_CQ.array());
  Text lastRowQualifier = new Text(Indexer.METRICS_TABLE_LAST_ROW_CQ.array());
  scanner.fetchColumn(family, firstRowQualifier);
  scanner.fetchColumn(family, lastRowQualifier);
  byte[] firstRow = null;
  byte[] lastRow = null;
  for (Entry<Key, Value> entry : scanner) {
    if (entry.getKey().compareColumnQualifier(firstRowQualifier) == 0) {
      firstRow = entry.getValue().get();
    }
    if (entry.getKey().compareColumnQualifier(lastRowQualifier) == 0) {
      lastRow = entry.getValue().get();
    }
  }
  scanner.close();
  return Pair.of(firstRow, lastRow);
}
origin: apache/accumulo

public static List<FileRef> getBulkFilesLoaded(ServerContext context, AccumuloClient client,
  KeyExtent extent, long tid) {
 List<FileRef> result = new ArrayList<>();
 try (Scanner mscanner = new IsolatedScanner(client.createScanner(
   extent.isMeta() ? RootTable.NAME : MetadataTable.NAME, Authorizations.EMPTY))) {
  VolumeManager fs = context.getVolumeManager();
  mscanner.setRange(extent.toMetadataRange());
  mscanner.fetchColumnFamily(TabletsSection.BulkFileColumnFamily.NAME);
  for (Entry<Key,Value> entry : mscanner) {
   if (Long.parseLong(entry.getValue().toString()) == tid) {
    result.add(new FileRef(fs, entry.getKey()));
   }
  }
  return result;
 } catch (TableNotFoundException ex) {
  // unlikely
  throw new RuntimeException("Onos! teh metadata table has vanished!!");
 }
}
origin: prestodb/presto

private long getNumRowsInTable(String metricsTable, Authorizations auths)
    throws TableNotFoundException
{
  // Create scanner against the metrics table, pulling the special column and the rows column
  Scanner scanner = connector.createScanner(metricsTable, auths);
  scanner.setRange(METRICS_TABLE_ROWID_RANGE);
  scanner.fetchColumn(METRICS_TABLE_ROWS_CF_AS_TEXT, CARDINALITY_CQ_AS_TEXT);
  // Scan the entry and get the number of rows
  long numRows = -1;
  for (Entry<Key, Value> entry : scanner) {
    if (numRows > 0) {
      throw new PrestoException(FUNCTION_IMPLEMENTATION_ERROR, "Should have received only one entry when scanning for number of rows in metrics table");
    }
    numRows = Long.parseLong(entry.getValue().toString());
  }
  scanner.close();
  LOG.debug("Number of rows in table is %d", numRows);
  return numRows;
}
origin: apache/accumulo

metadata.setRange(range);
metadata.fetchColumnFamily(DataFileColumnFamily.NAME);
int count = 0;
 Key key = entry.getKey();
 Path map = fs.getFullPath(key);
origin: prestodb/presto

private Optional<String> getDefaultTabletLocation(String fulltable)
{
  try {
    String tableId = connector.tableOperations().tableIdMap().get(fulltable);
    // Create a scanner over the metadata table, fetching the 'loc' column of the default tablet row
    Scanner scan = connector.createScanner("accumulo.metadata", connector.securityOperations().getUserAuthorizations(username));
    scan.fetchColumnFamily(new Text("loc"));
    scan.setRange(new Range(tableId + '<'));
    // scan the entry
    Optional<String> location = Optional.empty();
    for (Entry<Key, Value> entry : scan) {
      if (location.isPresent()) {
        throw new PrestoException(FUNCTION_IMPLEMENTATION_ERROR, "Scan for default tablet returned more than one entry");
      }
      location = Optional.of(entry.getValue().toString());
    }
    scan.close();
    return location;
  }
  catch (Exception e) {
    // Swallow this exception so the query does not fail due to being unable to locate the tablet server for the default tablet.
    // This is purely an optimization, but we will want to log the error.
    LOG.error("Failed to get tablet location, returning dummy location", e);
    return Optional.empty();
  }
}
origin: apache/accumulo

TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.fetch(metaScanner);
TabletsSection.ServerColumnFamily.TIME_COLUMN.fetch(metaScanner);
metaScanner.setRange(new KeyExtent(tableID, null, null).toMetadataRange());
 entry.getKey().write(dataOut);
 entry.getValue().write(dataOut);
 if (entry.getKey().getColumnFamily().equals(DataFileColumnFamily.NAME)) {
  String path = fs.getFullPath(entry.getKey()).toString();
  String tokens[] = path.split("/");
  if (tokens.length < 1) {
origin: brianfrankcooper/YCSB

scanner = connector.createScanner(table, Authorizations.EMPTY);
scanner.setRange(new Range(new Text(startkey), null));
for (Entry<Key, Value> entry : scanner) {
 SortedMap<Key, Value> row = WholeRowIterator.decodeRow(entry.getKey(), entry.getValue());
 HashMap<String, ByteIterator> rowData;
 if (null != fields) {
  rowEntry.getKey().getColumnQualifier(cq);
  rowData.put(cq.toString(), new ByteArrayByteIterator(rowEntry.getValue().get()));
origin: apache/accumulo

scanner.fetchColumnFamily(TabletsSection.CurrentLocationColumnFamily.NAME);
scanner.fetchColumnFamily(DataFileColumnFamily.NAME);
scanner.setRange(MetadataSchema.TabletsSection.getRange());
 Key key = entry.getKey();
 if (key.compareColumnFamily(TabletsSection.CurrentLocationColumnFamily.NAME) == 0) {
  String location = entry.getValue().toString();
 final String host = entry.getKey();
 final Long blocksForHost = entry.getValue();
 System.out.println(String.format("%15s %5.1f %8d", host,
origin: brianfrankcooper/YCSB

scanner = connector.createScanner(table, Authorizations.EMPTY);
scanner.setRange(new Range(new Text(startkey), null));
for (Entry<Key, Value> entry : scanner) {
 SortedMap<Key, Value> row = WholeRowIterator.decodeRow(entry.getKey(), entry.getValue());
 HashMap<String, ByteIterator> rowData;
 if (null != fields) {
  rowEntry.getKey().getColumnQualifier(cq);
  rowData.put(cq.toString(), new ByteArrayByteIterator(rowEntry.getValue().get()));
origin: apache/accumulo

mdScanner.setRange(new KeyExtent(tableId, null, null).toMetadataRange());
 String file = entry.getKey().getColumnQualifier().toString();
 String parts[] = file.split("/");
TreeSet<String> tableNames = new TreeSet<>();
for (Table.ID tableId : entry.getKey())
 tableNames.add(reverseTableIdMap.get(tableId));
origin: brianfrankcooper/YCSB

scanner = connector.createScanner(table, Authorizations.EMPTY);
scanner.setRange(new Range(new Text(startkey), null));
for (Entry<Key, Value> entry : scanner) {
 SortedMap<Key, Value> row = WholeRowIterator.decodeRow(entry.getKey(), entry.getValue());
 HashMap<String, ByteIterator> rowData;
 if (null != fields) {
  rowEntry.getKey().getColumnQualifier(cq);
  rowData.put(cq.toString(), new ByteArrayByteIterator(rowEntry.getValue().get()));
origin: apache/accumulo

scanner.setRange(MetadataSchema.TabletsSection.getRange());
scanner.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
scanner.fetchColumnFamily(MetadataSchema.TabletsSection.LogColumnFamily.NAME);
 if (entry.getKey().getColumnFamily()
   .equals(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME)) {
  volumes.add(getTableURI(entry.getKey().getColumnQualifier().toString()));
 } else if (entry.getKey().getColumnFamily()
   .equals(MetadataSchema.TabletsSection.LogColumnFamily.NAME)) {
  LogEntry le = LogEntry.fromKeyValue(entry.getKey(), entry.getValue());
scanner.setRange(MetadataSchema.DeletesSection.getRange());
origin: prestodb/presto

Scanner scanner = connector.createScanner("accumulo.metadata", auths);
scanner.fetchColumnFamily(new Text("loc"));
Key start = new Key(tableId);
Key end = defaultTabletRow.followingKey(PartialKey.ROW);
scanner.setRange(new Range(start, end));
    byte[] keyBytes = entry.getKey().getRow().copyBytes();
origin: apache/accumulo

public static SortedMap<FileRef,DataFileValue> getDataFileSizes(KeyExtent extent,
  ServerContext context) {
 TreeMap<FileRef,DataFileValue> sizes = new TreeMap<>();
 try (Scanner mdScanner = new ScannerImpl(context, MetadataTable.ID, Authorizations.EMPTY)) {
  mdScanner.fetchColumnFamily(DataFileColumnFamily.NAME);
  Text row = extent.getMetadataEntry();
  Key endKey = new Key(row, DataFileColumnFamily.NAME, new Text(""));
  endKey = endKey.followingKey(PartialKey.ROW_COLFAM);
  mdScanner.setRange(new Range(new Key(row), endKey));
  for (Entry<Key,Value> entry : mdScanner) {
   if (!entry.getKey().getRow().equals(row))
    break;
   DataFileValue dfv = new DataFileValue(entry.getValue().get());
   sizes.put(new FileRef(context.getVolumeManager(), entry.getKey()), dfv);
  }
  return sizes;
 }
}
org.apache.accumulo.core.clientScannersetRange

Javadoc

Sets the range of keys to scan over.

Popular methods of Scanner

  • iterator
  • fetchColumnFamily
  • addScanIterator
  • close
  • fetchColumn
  • clearColumns
  • setBatchSize
    Sets the number of Key/Value pairs that will be fetched at a time from a tablet server.
  • clearScanIterators
  • setReadaheadThreshold
    Sets the number of batches of Key/Value pairs returned before the Scanner will begin to prefetch the
  • setTimeout
  • getRange
    Returns the range of keys to scan over.
  • enableIsolation
    Enables row isolation. Writes that occur to a row after a scan of that row has begun will not be see
  • getRange,
  • enableIsolation,
  • getBatchSize,
  • setBatchTimeout,
  • setClassLoaderContext,
  • setSamplerConfiguration,
  • clearClassLoaderContext,
  • clearSamplerConfiguration,
  • disableIsolation

Popular in Java

  • Parsing JSON documents to java classes using gson
  • notifyDataSetChanged (ArrayAdapter)
  • compareTo (BigDecimal)
    Compares this BigDecimal with the specified BigDecimal. Two BigDecimal objects that are equal in val
  • setScale (BigDecimal)
    Returns a BigDecimal whose scale is the specified value, and whose value is numerically equal to thi
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • MessageFormat (java.text)
    MessageFormat provides a means to produce concatenated messages in language-neutral way. Use this to
  • LinkedHashMap (java.util)
    Hash table and linked list implementation of the Map interface, with predictable iteration order. Th
  • JLabel (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now