/** * <p> * The maximum number of items to evaluate (not necessarily the number of matching items). If DynamoDB processes the * number of items up to the limit while processing the results, it stops the operation and returns the matching * values up to that point, and a key in <code>LastEvaluatedKey</code> to apply in a subsequent operation, so that * you can pick up where you left off. Also, if the processed data set size exceeds 1 MB before DynamoDB reaches * this limit, it stops the operation and returns the matching values up to the limit, and a key in * <code>LastEvaluatedKey</code> to apply in a subsequent operation to continue the operation. For more information, * see <a href="http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/QueryAndScan.html">Query and * Scan</a> in the <i>Amazon DynamoDB Developer Guide</i>. * </p> * * @param limit * The maximum number of items to evaluate (not necessarily the number of matching items). If DynamoDB * processes the number of items up to the limit while processing the results, it stops the operation and * returns the matching values up to that point, and a key in <code>LastEvaluatedKey</code> to apply in a * subsequent operation, so that you can pick up where you left off. Also, if the processed data set size * exceeds 1 MB before DynamoDB reaches this limit, it stops the operation and returns the matching values up * to the limit, and a key in <code>LastEvaluatedKey</code> to apply in a subsequent operation to continue * the operation. For more information, see <a * href="http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/QueryAndScan.html">Query and * Scan</a> in the <i>Amazon DynamoDB Developer Guide</i>. * @return Returns a reference to this object so that method calls can be chained together. */ public ScanRequest withLimit(Integer limit) { setLimit(limit); return this; }
@Override public Page<Item, ScanOutcome> nextPage() { if (lastEvaluatedKey == null) { throw new NoSuchElementException("No more pages"); } final Integer max = spec.getMaxResultSize(); if (max != null) { int nextLimit = nextRequestLimit(max.intValue()); if (nextLimit == 0) throw new NoSuchElementException("No more pages"); request.setLimit(nextLimit); } request.setExclusiveStartKey(lastEvaluatedKey); // fire off request to the server side ScanResult result = client.scan(request); final int nextIndex = index + this.size(); return new ScanPage(client, spec, request, nextIndex, new ScanOutcome(result)); } }
while (count < recordcount) { req.setExclusiveStartKey(startKey); req.setLimit(recordcount - count); ScanResult res; try {
@Override public Page<Item, ScanOutcome> firstPage() { ScanRequest request = spec.getRequest(); request.setExclusiveStartKey(startKey); request.setLimit(InternalUtils.minimum( spec.getMaxResultSize(), spec.getMaxPageSize())); ScanResult result = client.scan(request); ScanOutcome outcome = new ScanOutcome(result); setLastLowLevelResult(outcome); return new ScanPage(client, spec, request, 0, outcome); }
/** * @param config never null */ private ScanRequest createScanRequestFromExpression(Class<?> clazz, DynamoDBScanExpression scanExpression, DynamoDBMapperConfig config) { ScanRequest scanRequest = new ScanRequest(); scanRequest.setTableName(getTableName(clazz, config)); scanRequest.setIndexName(scanExpression.getIndexName()); scanRequest.setScanFilter(scanExpression.getScanFilter()); scanRequest.setLimit(scanExpression.getLimit()); scanRequest.setExclusiveStartKey(scanExpression.getExclusiveStartKey()); scanRequest.setTotalSegments(scanExpression.getTotalSegments()); scanRequest.setSegment(scanExpression.getSegment()); scanRequest.setConditionalOperator(scanExpression.getConditionalOperator()); scanRequest.setFilterExpression(scanExpression.getFilterExpression()); scanRequest.setExpressionAttributeNames(scanExpression .getExpressionAttributeNames()); scanRequest.setExpressionAttributeValues(scanExpression .getExpressionAttributeValues()); scanRequest.setRequestMetricCollector(config.getRequestMetricCollector()); scanRequest.setSelect(scanExpression.getSelect()); scanRequest.setProjectionExpression(scanExpression.getProjectionExpression()); scanRequest.setReturnConsumedCapacity(scanExpression.getReturnConsumedCapacity()); scanRequest.setConsistentRead(scanExpression.isConsistentRead()); return applyUserAgent(scanRequest); }
/** * <p> * The maximum number of items to evaluate (not necessarily the number of matching items). If DynamoDB processes the * number of items up to the limit while processing the results, it stops the operation and returns the matching * values up to that point, and a key in <code>LastEvaluatedKey</code> to apply in a subsequent operation, so that * you can pick up where you left off. Also, if the processed data set size exceeds 1 MB before DynamoDB reaches * this limit, it stops the operation and returns the matching values up to the limit, and a key in * <code>LastEvaluatedKey</code> to apply in a subsequent operation to continue the operation. For more information, * see <a href="http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/QueryAndScan.html">Query and * Scan</a> in the <i>Amazon DynamoDB Developer Guide</i>. * </p> * * @param limit * The maximum number of items to evaluate (not necessarily the number of matching items). If DynamoDB * processes the number of items up to the limit while processing the results, it stops the operation and * returns the matching values up to that point, and a key in <code>LastEvaluatedKey</code> to apply in a * subsequent operation, so that you can pick up where you left off. Also, if the processed data set size * exceeds 1 MB before DynamoDB reaches this limit, it stops the operation and returns the matching values up * to the limit, and a key in <code>LastEvaluatedKey</code> to apply in a subsequent operation to continue * the operation. For more information, see <a * href="http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/QueryAndScan.html">Query and * Scan</a> in the <i>Amazon DynamoDB Developer Guide</i>. * @return Returns a reference to this object so that method calls can be chained together. */ public ScanRequest withLimit(Integer limit) { setLimit(limit); return this; }
/** * @param config never null */ ScanRequest createScanRequestFromExpression(Class<?> clazz, DynamoDBScanExpression scanExpression, DynamoDBMapperConfig config) { final ScanRequest scanRequest = new ScanRequest(); scanRequest.setTableName(getTableName(clazz, config)); scanRequest.setScanFilter(scanExpression.getScanFilter()); scanRequest.setLimit(scanExpression.getLimit()); scanRequest.setExclusiveStartKey(scanExpression.getExclusiveStartKey()); scanRequest.setTotalSegments(scanExpression.getTotalSegments()); scanRequest.setSegment(scanExpression.getSegment()); scanRequest.setConditionalOperator(scanExpression.getConditionalOperator()); scanRequest.setFilterExpression(scanExpression.getFilterExpression()); scanRequest.setExpressionAttributeNames(scanExpression .getExpressionAttributeNames()); scanRequest.setExpressionAttributeValues(scanExpression .getExpressionAttributeValues()); scanRequest.setRequestMetricCollector(config.getRequestMetricCollector()); return applyUserAgent(scanRequest); }
@Override protected DataSet materializeMainSchemaTable(Table table, List<Column> columns, int maxRows) { final List<String> attributeNames = columns.stream().map(col-> col.getName()).collect(Collectors.toList()); final ScanRequest scanRequest = new ScanRequest(table.getName()); scanRequest.setAttributesToGet(attributeNames); if (maxRows > 0) { scanRequest.setLimit(maxRows); } final ScanResult result = _dynamoDb.scan(scanRequest); return new DynamoDbDataSet(columns, result); }
scanRequest.setTableName(table); if (limit != null) { scanRequest.setLimit(limit);
@Override public Page<Item, ScanOutcome> nextPage() { if (lastEvaluatedKey == null) { throw new NoSuchElementException("No more pages"); } final Integer max = spec.getMaxResultSize(); if (max != null) { int nextLimit = nextRequestLimit(max.intValue()); if (nextLimit == 0) throw new NoSuchElementException("No more pages"); request.setLimit(nextLimit); } request.setExclusiveStartKey(lastEvaluatedKey); // fire off request to the server side ScanResult result = client.scan(request); final int nextIndex = index + this.size(); return new ScanPage(client, spec, request, nextIndex, new ScanOutcome(result)); } }
@Override public Page<Item, ScanOutcome> firstPage() { ScanRequest request = spec.getRequest(); request.setExclusiveStartKey(startKey); request.setLimit(InternalUtils.minimum( spec.getMaxResultSize(), spec.getMaxPageSize())); ScanResult result = client.scan(request); ScanOutcome outcome = new ScanOutcome(result); setLastLowLevelResult(outcome); return new ScanPage(client, spec, request, 0, outcome); }
/** * @param config never null */ private ScanRequest createScanRequestFromExpression(Class<?> clazz, DynamoDBScanExpression scanExpression, DynamoDBMapperConfig config) { ScanRequest scanRequest = new ScanRequest(); scanRequest.setTableName(getTableName(clazz, config)); scanRequest.setIndexName(scanExpression.getIndexName()); scanRequest.setScanFilter(scanExpression.getScanFilter()); scanRequest.setLimit(scanExpression.getLimit()); scanRequest.setExclusiveStartKey(scanExpression.getExclusiveStartKey()); scanRequest.setTotalSegments(scanExpression.getTotalSegments()); scanRequest.setSegment(scanExpression.getSegment()); scanRequest.setConditionalOperator(scanExpression.getConditionalOperator()); scanRequest.setFilterExpression(scanExpression.getFilterExpression()); scanRequest.setExpressionAttributeNames(scanExpression .getExpressionAttributeNames()); scanRequest.setExpressionAttributeValues(scanExpression .getExpressionAttributeValues()); scanRequest.setRequestMetricCollector(config.getRequestMetricCollector()); scanRequest.setSelect(scanExpression.getSelect()); scanRequest.setProjectionExpression(scanExpression.getProjectionExpression()); scanRequest.setReturnConsumedCapacity(scanExpression.getReturnConsumedCapacity()); scanRequest.setConsistentRead(scanExpression.isConsistentRead()); return applyUserAgent(scanRequest); }