Example usage for com.amazonaws.services.dynamodbv2.model QueryResult getScannedCount

List of usage examples for com.amazonaws.services.dynamodbv2.model QueryResult getScannedCount

Introduction

In this page you can find the example usage for com.amazonaws.services.dynamodbv2.model QueryResult getScannedCount.

Prototype


public Integer getScannedCount() 

Source Link

Document

The number of items evaluated, before any QueryFilter is applied.

Usage

From source file:com.amazon.janusgraph.diskstorage.dynamodb.QueryWorker.java

License:Open Source License

@Override
public QueryResultWrapper next() throws BackendException {
    final Query backoff = new ExponentialBackoff.Query(request, delegate, permitsToConsume);
    final QueryResult result = backoff.runWithBackoff();
    final ConsumedCapacity consumedCapacity = result.getConsumedCapacity();
    if (null != consumedCapacity) {
        permitsToConsume = Math.max((int) (consumedCapacity.getCapacityUnits() - 1.0), 1);
        totalCapacityUnits += consumedCapacity.getCapacityUnits();
    }// w  w w . java 2  s .  co  m

    if (result.getLastEvaluatedKey() != null && !result.getLastEvaluatedKey().isEmpty()) {
        request.setExclusiveStartKey(result.getLastEvaluatedKey());
    } else {
        markComplete();
    }
    // a update returned count
    returnedCount += result.getCount();

    // b update scanned count
    scannedCount += result.getScannedCount();
    // c add scanned finalItemList
    finalItemList.addAll(result.getItems());
    return new QueryResultWrapper(titanKey, result);
}

From source file:com.rapid7.diskstorage.dynamodb.QueryWorker.java

License:Open Source License

@Override
public QueryResultWrapper next() throws BackendException {
    ExponentialBackoff.Query backoff = new ExponentialBackoff.Query(request, delegate, permitsToConsume);
    QueryResult result = backoff.runWithBackoff();
    ConsumedCapacity consumedCapacity = result.getConsumedCapacity();
    if (null != consumedCapacity) {
        permitsToConsume = Math.max((int) (consumedCapacity.getCapacityUnits() - 1.0), 1);
        totalCapacityUnits += consumedCapacity.getCapacityUnits();
    }/*ww  w  .ja  v a 2  s  .  co m*/

    if (result.getLastEvaluatedKey() != null && !result.getLastEvaluatedKey().isEmpty()) {
        request.setExclusiveStartKey(result.getLastEvaluatedKey());
    } else {
        markComplete();
    }
    // a update returned count
    returnedCount += result.getCount();

    // b update scanned count
    scannedCount += result.getScannedCount();
    // c add scanned items
    items.addAll(result.getItems());
    return new QueryResultWrapper(titanKey, result);
}