Tabnine Logo
Scanner.fetchColumn
Code IndexAdd Tabnine to your IDE (free)

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

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

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: org.apache.accumulo/accumulo-test

private static long scan(Connector conn, ArrayList<byte[]> cfset, String table, boolean cq)
  throws TableNotFoundException {
 Scanner scanner = conn.createScanner(table, Authorizations.EMPTY);
 if (!cq)
  scanner.fetchColumnFamily(new Text(cfset.get(15)));
 else
  scanner.fetchColumn(new Text(cfset.get(15)), new Text(cfset.get(15)));
 long t1 = System.currentTimeMillis();
 Iterators.size(scanner.iterator());
 long t2 = System.currentTimeMillis();
 return t2 - t1;
}
origin: apache/gora

private void setFetchColumns(Scanner scanner, String[] fields) {
 fields = getFieldsToQuery(fields);
 for (String field : fields) {
  Pair<Text,Text> col = mapping.fieldMap.get(field);
  if (col != null) {
   if (col.getSecond() == null) {
    scanner.fetchColumnFamily(col.getFirst());
   } else {
    scanner.fetchColumn(col.getFirst(), col.getSecond());
   }
  } else {
   LOG.error("Mapping not found for field: {}", field);
  }
 }
}
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/fluo

public static void scanAccumulo(ScanOpts options, FluoConfiguration sConfig, PrintStream out) {
 AccumuloClient client = AccumuloUtil.getClient(sConfig);
 Span span = getSpan(options);
 Collection<Column> columns = getColumns(options);
 try {
  Scanner scanner = client.createScanner(sConfig.getAccumuloTable(), Authorizations.EMPTY);
  scanner.setRange(SpanUtil.toRange(span));
  for (Column col : columns) {
   if (col.isQualifierSet()) {
    scanner.fetchColumn(ByteUtil.toText(col.getFamily()),
      ByteUtil.toText(col.getQualifier()));
   } else {
    scanner.fetchColumnFamily(ByteUtil.toText(col.getFamily()));
   }
  }
  for (String entry : Iterables.transform(scanner, FluoFormatter::toString)) {
   out.println(entry);
  }
  out.flush();
 } catch (Exception e) {
  throw new RuntimeException(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: 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: 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: brianfrankcooper/YCSB

scanner.fetchColumn(colFam, new Text(field));
origin: brianfrankcooper/YCSB

scanner.fetchColumn(colFam, new Text(field));
origin: brianfrankcooper/YCSB

scanner.fetchColumn(colFam, new Text(field));
origin: apache/accumulo

 protected Status getStatus(String file, ReplicationTarget target)
   throws ReplicationTableOfflineException, InvalidProtocolBufferException {
  Scanner s = ReplicationTable.getScanner(context);
  s.setRange(Range.exact(file));
  s.fetchColumn(WorkSection.NAME, target.toText());
  return Status.parseFrom(Iterables.getOnlyElement(s).getValue().get());
 }
}
origin: ucbrise/anna

/**
 * 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(Text row, Set<String> fields) {
 singleScanner.clearColumns();
 singleScanner.setRange(new Range(row));
 if (fields != null) {
  for (String field : fields) {
   singleScanner.fetchColumn(colFam, new Text(field));
  }
 }
 return singleScanner;
}
origin: org.apache.rya/accumulo.rya

@Override
public String getNamespace(final String pfx) throws RyaDAOException {
  try {
    final Scanner scanner = connector.createScanner(tableLayoutStrategy.getNs(),
        ALL_AUTHORIZATIONS);
    scanner.fetchColumn(INFO_NAMESPACE_TXT, EMPTY_TEXT);
    scanner.setRange(new Range(new Text(pfx)));
    final Iterator<Map.Entry<Key, Value>> iterator = scanner
        .iterator();
    if (iterator.hasNext()) {
      return new String(iterator.next().getValue().get(), StandardCharsets.UTF_8);
    }
  } catch (final Exception e) {
    throw new RyaDAOException(e);
  }
  return null;
}
origin: org.apache.rya/rya.indexing

/**
 * find intervals stored in the repository before the given Interval. Find interval endings that are
 * before the given beginning.
 * Indexing Intervals  will probably change or be removed.
 * Currently predicate and subject constraints are filtered on the client.
 */
@Override
public CloseableIteration<Statement, QueryEvaluationException> queryIntervalBefore(
    final TemporalInterval queryInterval, final StatementConstraints constraints) throws QueryEvaluationException
{
  final Scanner scanner = getScanner();
  if (scanner != null) {
    // get rows where the end date is less than the queryInterval.getBefore()
    final Range range = new Range(null, false, new Key(new Text(queryInterval.getHasBeginning().getAsKeyBytes())), false);
    scanner.setRange(range);
     if (constraints.hasContext()) {
      scanner.fetchColumn(new Text(constraints.getContext().toString()), new Text(KeyParts.CQ_END));
    } else {
      scanner.fetchColumn(new Text(""), new Text(KeyParts.CQ_END));
    }
  }
  return getIteratorWrapper(scanner);
}
origin: apache/incubator-rya

@Override
public String getNamespace(final String pfx) throws RyaDAOException {
  try {
    final Scanner scanner = connector.createScanner(tableLayoutStrategy.getNs(),
        ALL_AUTHORIZATIONS);
    scanner.fetchColumn(INFO_NAMESPACE_TXT, EMPTY_TEXT);
    scanner.setRange(new Range(new Text(pfx)));
    final Iterator<Map.Entry<Key, Value>> iterator = scanner
        .iterator();
    if (iterator.hasNext()) {
      return new String(iterator.next().getValue().get(), StandardCharsets.UTF_8);
    }
  } catch (final Exception e) {
    throw new RyaDAOException(e);
  }
  return null;
}
origin: apache/incubator-rya

@Override
public boolean isInitialized() throws RyaDetailsRepositoryException {
  Scanner scanner = null;
  try {
    scanner = connector.createScanner(detailsTableName, new Authorizations());
    scanner.fetchColumn(COL_FAMILY, COL_QUALIFIER);
    return scanner.iterator().hasNext();
  } catch (final TableNotFoundException e) {
    return false;
  } finally {
    if(scanner != null) {
      scanner.close();
    }
  }
}
origin: org.apache.rya/accumulo.rya

@Override
public boolean isInitialized() throws RyaDetailsRepositoryException {
  Scanner scanner = null;
  try {
    scanner = connector.createScanner(detailsTableName, new Authorizations());
    scanner.fetchColumn(COL_FAMILY, COL_QUALIFIER);
    return scanner.iterator().hasNext();
  } catch (final TableNotFoundException e) {
    return false;
  } finally {
    if(scanner != null) {
      scanner.close();
    }
  }
}
origin: org.apache.accumulo/accumulo-tserver

 protected Status getStatus(String file, ReplicationTarget target)
   throws ReplicationTableOfflineException, AccumuloException, AccumuloSecurityException,
   InvalidProtocolBufferException {
  Scanner s = ReplicationTable.getScanner(context.getConnector());
  s.setRange(Range.exact(file));
  s.fetchColumn(WorkSection.NAME, target.toText());

  return Status.parseFrom(Iterables.getOnlyElement(s).getValue().get());
 }
}
origin: apache/fluo

public static long getNotificationTS(Environment env, String row, Column col) {
 Scanner scanner;
 try {
  scanner = env.getAccumuloClient().createScanner(env.getTable(), env.getAuthorizations());
 } catch (TableNotFoundException e) {
  throw new RuntimeException(e);
 }
 IteratorSetting iterCfg = new IteratorSetting(11, NotificationIterator.class);
 scanner.addScanIterator(iterCfg);
 Text cv = ByteUtil.toText(col.getVisibility());
 scanner.setRange(SpanUtil.toRange(Span.prefix(row)));
 scanner.fetchColumn(ByteUtil.toText(ColumnConstants.NOTIFY_CF),
   new Text(NotificationUtil.encodeCol(col)));
 for (Entry<Key, org.apache.accumulo.core.data.Value> entry : scanner) {
  if (entry.getKey().getColumnVisibility().equals(cv)) {
   return Notification.from(entry.getKey()).getTimestamp();
  }
 }
 throw new RuntimeException("No notification found");
}
org.apache.accumulo.core.clientScannerfetchColumn

Popular methods of Scanner

  • setRange
    Sets the range of keys to scan over.
  • iterator
  • fetchColumnFamily
  • addScanIterator
  • close
  • 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

  • Finding current android device location
  • getSystemService (Context)
  • requestLocationUpdates (LocationManager)
  • compareTo (BigDecimal)
  • PrintStream (java.io)
    Fake signature of an existing Java class.
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • JLabel (javax.swing)
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now