Search in sources :

Example 1 with CellScanner

use of org.apache.fluo.api.client.scanner.CellScanner in project incubator-rya by apache.

the class ListQueryIds method listQueryIds.

/**
 * Finds all queries that are being managed by this instance of Fluo that
 * are also being exported to the provided instance of Accumulo.
 *
 * @param fluo - The Fluo instance that will be searched. (not null)
 * @return An ascending alphabetically sorted list of the Query IDs being
 *   managed by the Fluo app and exported to an instance of Accumulo.
 */
public List<String> listQueryIds(final FluoClient fluo) {
    checkNotNull(fluo);
    final List<String> queryIds = new ArrayList<>();
    try (Snapshot snap = fluo.newSnapshot()) {
        // Create an iterator that iterates over the QUERY_ID column.
        final CellScanner cellScanner = snap.scanner().fetch(FluoQueryColumns.QUERY_NODE_ID).build();
        for (RowColumnValue rcv : cellScanner) {
            queryIds.add(rcv.getsValue());
        // TODO this was doing a snap.get that seemed unnecessary
        }
    }
    // Sort them alphabetically.
    Collections.sort(queryIds);
    return queryIds;
}
Also used : Snapshot(org.apache.fluo.api.client.Snapshot) ArrayList(java.util.ArrayList) CellScanner(org.apache.fluo.api.client.scanner.CellScanner) RowColumnValue(org.apache.fluo.api.data.RowColumnValue)

Example 2 with CellScanner

use of org.apache.fluo.api.client.scanner.CellScanner in project incubator-rya by apache.

the class IncUpdateDAO method printAll.

/**
 * Print all rows in the Fluo table for diagnostics.
 * </p>
 * Consider using {@code FluoITHelper.printFluoTable(FluoClient client)} instead.
 */
@Deprecated
public static void printAll(final SnapshotBase sx) {
    final String FORMAT = "%-30s | %-10s | %-10s | %-40s\n";
    System.out.println("Printing all tables.  Showing unprintable bytes and braces as {ff} and {{} and {}} where ff is the value in hexadecimal.");
    System.out.format(FORMAT, "--Row--", "--Column Family--", "--Column Qual--", "--Value--");
    final CellScanner cscanner = sx.scanner().build();
    for (final RowColumnValue rcv : cscanner) {
        System.out.format(FORMAT, to_String(rcv.getRow()), to_String(rcv.getColumn().getFamily()), to_String(rcv.getColumn().getQualifier()), to_String(rcv.getValue()));
    }
}
Also used : CellScanner(org.apache.fluo.api.client.scanner.CellScanner) RowColumnValue(org.apache.fluo.api.data.RowColumnValue)

Aggregations

CellScanner (org.apache.fluo.api.client.scanner.CellScanner)2 RowColumnValue (org.apache.fluo.api.data.RowColumnValue)2 ArrayList (java.util.ArrayList)1 Snapshot (org.apache.fluo.api.client.Snapshot)1