.withLimit(limit) .withTableName(tableName) .withConsistentRead(isConsistentRead) .withIndexName(this.indexName);
.withTableName(tableName) .withSelect(Select.COUNT) .withConsistentRead(isConsistentRead) .withIndexName(this.indexName);
protected QueryRequest createQueryRequest() { return new QueryRequest() .withTableName(tableName) .withConsistentRead(forceConsistentRead) .withReturnConsumedCapacity(ReturnConsumedCapacity.TOTAL); } protected ScanRequest createScanRequest() {
@Override public long getMaxVersion(final String materialName) { final List<Map<String, AttributeValue>> items = ddb.query( new QueryRequest() .withTableName(tableName) .withConsistentRead(Boolean.TRUE) .withKeyConditions( Collections.singletonMap( DEFAULT_HASH_KEY, new Condition().withComparisonOperator( ComparisonOperator.EQ).withAttributeValueList( new AttributeValue().withS(materialName)))) .withLimit(1).withScanIndexForward(false) .withAttributesToGet(DEFAULT_RANGE_KEY)).getItems(); if (items.isEmpty()) { return -1L; } else { return Long.parseLong(items.get(0).get(DEFAULT_RANGE_KEY).getN()); } }
.withConsistentRead(true).withScanIndexForward(true) .withReturnConsumedCapacity(ReturnConsumedCapacity.TOTAL);
@Override public long getMaxVersion(final String materialName) { final List<Map<String, AttributeValue>> items = ddb.query( new QueryRequest() .withTableName(tableName) .withConsistentRead(Boolean.TRUE) .withKeyConditions( Collections.singletonMap( DEFAULT_HASH_KEY, new Condition().withComparisonOperator( ComparisonOperator.EQ).withAttributeValueList( new AttributeValue().withS(materialName)))) .withLimit(1).withScanIndexForward(false) .withAttributesToGet(DEFAULT_RANGE_KEY)).getItems(); if (items.isEmpty()) { return -1L; } else { return Long.parseLong(items.get(0).get(DEFAULT_RANGE_KEY).getN()); } }
.withReturnConsumedCapacity(ReturnConsumedCapacity.TOTAL) .withKeyConditions(conditions) .withConsistentRead(this.consistent) .withScanIndexForward(this.forward) .withSelect(this.select)
.withReturnConsumedCapacity(ReturnConsumedCapacity.TOTAL) .withKeyConditions(conditions) .withConsistentRead(this.consistent) .withScanIndexForward(this.forward) .withSelect(this.select)
.withIndexName(config.getGeohashIndexName()).withConsistentRead(true) .withReturnConsumedCapacity(ReturnConsumedCapacity.TOTAL).withExclusiveStartKey(lastEvaluatedKey);
.withReturnConsumedCapacity(ReturnConsumedCapacity.TOTAL) .withKeyConditions(conditions) .withConsistentRead(this.consistent) .withSelect(Select.COUNT) .withLimit(Integer.MAX_VALUE);
.withReturnConsumedCapacity(ReturnConsumedCapacity.TOTAL) .withKeyConditions(conditions) .withConsistentRead(this.consistent) .withSelect(Select.COUNT) .withLimit(Integer.MAX_VALUE);
public static QueryRequest copyQueryRequest(QueryRequest queryRequest) { QueryRequest copiedQueryRequest = new QueryRequest().withAttributesToGet(queryRequest.getAttributesToGet()) .withConsistentRead(queryRequest.getConsistentRead()) .withExclusiveStartKey(queryRequest.getExclusiveStartKey()).withIndexName(queryRequest.getIndexName()) .withKeyConditions(queryRequest.getKeyConditions()).withLimit(queryRequest.getLimit()) .withReturnConsumedCapacity(queryRequest.getReturnConsumedCapacity()) .withScanIndexForward(queryRequest.getScanIndexForward()).withSelect(queryRequest.getSelect()) .withTableName(queryRequest.getTableName()); return copiedQueryRequest; } }