/** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getItems() != null) sb.append("Items: ").append(getItems()).append(","); if (getCount() != null) sb.append("Count: ").append(getCount()).append(","); if (getScannedCount() != null) sb.append("ScannedCount: ").append(getScannedCount()).append(","); if (getLastEvaluatedKey() != null) sb.append("LastEvaluatedKey: ").append(getLastEvaluatedKey()).append(","); if (getConsumedCapacity() != null) sb.append("ConsumedCapacity: ").append(getConsumedCapacity()); sb.append("}"); return sb.toString(); }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getItems() == null) ? 0 : getItems().hashCode()); hashCode = prime * hashCode + ((getCount() == null) ? 0 : getCount().hashCode()); hashCode = prime * hashCode + ((getScannedCount() == null) ? 0 : getScannedCount().hashCode()); hashCode = prime * hashCode + ((getLastEvaluatedKey() == null) ? 0 : getLastEvaluatedKey().hashCode()); hashCode = prime * hashCode + ((getConsumedCapacity() == null) ? 0 : getConsumedCapacity().hashCode()); return hashCode; }
protected void setLastLowLevelResult(QueryOutcome lowLevelResult) { super.setLastLowLevelResult(lowLevelResult); QueryResult result = lowLevelResult.getQueryResult(); accumulateStats(result.getConsumedCapacity(), result.getCount(), result.getScannedCount()); } }
if (other.getLastEvaluatedKey() != null && other.getLastEvaluatedKey().equals(this.getLastEvaluatedKey()) == false) return false; if (other.getConsumedCapacity() == null ^ this.getConsumedCapacity() == null) return false; if (other.getConsumedCapacity() != null && other.getConsumedCapacity().equals(this.getConsumedCapacity()) == false) return false; return true;
@Override public <T> QueryResultPage<T> queryPage(Class<T> clazz, DynamoDBQueryExpression<T> queryExpression, DynamoDBMapperConfig config) { config = mergeConfig(config); QueryRequest queryRequest = createQueryRequestFromExpression(clazz, queryExpression, config); QueryResult queryResult = db.query(applyUserAgent(queryRequest)); QueryResultPage<T> result = new QueryResultPage<T>(); List<AttributeTransformer.Parameters<T>> parameters = toParameters(queryResult.getItems(), clazz, queryRequest.getTableName(), config); result.setResults(marshallIntoObjects(parameters)); result.setLastEvaluatedKey(queryResult.getLastEvaluatedKey()); result.setCount(queryResult.getCount()); result.setScannedCount(queryResult.getScannedCount()); result.setConsumedCapacity(queryResult.getConsumedCapacity()); return result; }
/** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getItems() != null) sb.append("Items: " + getItems() + ","); if (getCount() != null) sb.append("Count: " + getCount() + ","); if (getScannedCount() != null) sb.append("ScannedCount: " + getScannedCount() + ","); if (getLastEvaluatedKey() != null) sb.append("LastEvaluatedKey: " + getLastEvaluatedKey() + ","); if (getConsumedCapacity() != null) sb.append("ConsumedCapacity: " + getConsumedCapacity()); sb.append("}"); return sb.toString(); }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getItems() == null) ? 0 : getItems().hashCode()); hashCode = prime * hashCode + ((getCount() == null) ? 0 : getCount().hashCode()); hashCode = prime * hashCode + ((getScannedCount() == null) ? 0 : getScannedCount().hashCode()); hashCode = prime * hashCode + ((getLastEvaluatedKey() == null) ? 0 : getLastEvaluatedKey().hashCode()); hashCode = prime * hashCode + ((getConsumedCapacity() == null) ? 0 : getConsumedCapacity().hashCode()); return hashCode; }
&& other.getLastEvaluatedKey().equals(this.getLastEvaluatedKey()) == false) return false; if (other.getConsumedCapacity() == null ^ this.getConsumedCapacity() == null) return false; if (other.getConsumedCapacity() != null && other.getConsumedCapacity().equals(this.getConsumedCapacity()) == false) return false; return true;
/** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getItems() != null) sb.append("Items: ").append(getItems()).append(","); if (getCount() != null) sb.append("Count: ").append(getCount()).append(","); if (getScannedCount() != null) sb.append("ScannedCount: ").append(getScannedCount()).append(","); if (getLastEvaluatedKey() != null) sb.append("LastEvaluatedKey: ").append(getLastEvaluatedKey()).append(","); if (getConsumedCapacity() != null) sb.append("ConsumedCapacity: ").append(getConsumedCapacity()); sb.append("}"); return sb.toString(); }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getItems() == null) ? 0 : getItems().hashCode()); hashCode = prime * hashCode + ((getCount() == null) ? 0 : getCount().hashCode()); hashCode = prime * hashCode + ((getScannedCount() == null) ? 0 : getScannedCount().hashCode()); hashCode = prime * hashCode + ((getLastEvaluatedKey() == null) ? 0 : getLastEvaluatedKey().hashCode()); hashCode = prime * hashCode + ((getConsumedCapacity() == null) ? 0 : getConsumedCapacity().hashCode()); return hashCode; }
if (other.getLastEvaluatedKey() != null && other.getLastEvaluatedKey().equals(this.getLastEvaluatedKey()) == false) return false; if (other.getConsumedCapacity() == null ^ this.getConsumedCapacity() == null) return false; if (other.getConsumedCapacity() != null && other.getConsumedCapacity().equals(this.getConsumedCapacity()) == false) return false; return true;
protected void setLastLowLevelResult(QueryOutcome lowLevelResult) { super.setLastLowLevelResult(lowLevelResult); QueryResult result = lowLevelResult.getQueryResult(); accumulateStats(result.getConsumedCapacity(), result.getCount(), result.getScannedCount()); } }
@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(); } 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); }
@Override protected PageResults<Map<String, AttributeValue>> fetchPage(RequestLimit lim) { // Read from DynamoDB RetryResult<QueryResult> retryResult = context.getClient().queryTable(tableName, context .getSplit().getFilterPushdown(), lastEvaluatedKey, lim.items, context.getReporter()); QueryResult result = retryResult.result; int retries = retryResult.retries; return new PageResults<>(result.getItems(), result.getLastEvaluatedKey(), result .getConsumedCapacity().getCapacityUnits(), retries); } }
public QueryResult query(final QueryRequest request, final int permitsToConsume) throws BackendException { setUserAgent(request); QueryResult result; timedReadThrottle(QUERY, request.getTableName(), permitsToConsume); final Timer.Context apiTimerContext = getTimerContext(QUERY, request.getTableName()); try { result = client.query(request); } catch (Exception e) { throw processDynamoDbApiException(e, QUERY, request.getTableName()); } finally { apiTimerContext.stop(); } meterConsumedCapacity(QUERY, result.getConsumedCapacity()); measureItemCount(QUERY, request.getTableName(), result.getCount()); return result; }
@Override protected PageResults<Map<String, AttributeValue>> fetchPage(RequestLimit lim) { // Read from DynamoDB RetryResult<QueryResult> retryResult = context.getClient().queryTable(tableName, context .getSplit().getFilterPushdown(), lastEvaluatedKey, lim.items, context.getReporter()); QueryResult result = retryResult.result; int retries = retryResult.retries; return new PageResults<>(result.getItems(), result.getLastEvaluatedKey(), result .getConsumedCapacity().getCapacityUnits(), retries); } }
count, request.getTableName(), request.getQueryFilter(), new PrintableConsumedCapacity( rslt.getConsumedCapacity() ).print(), System.currentTimeMillis() - start
rqst.getKeyConditions(), new PrintableConsumedCapacity( rslt.getConsumedCapacity() ).print(), System.currentTimeMillis() - start
rqst.getKeyConditions(), new PrintableConsumedCapacity( rslt.getConsumedCapacity() ).print(), System.currentTimeMillis() - start
@Override public <T> QueryResultPage<T> queryPage(Class<T> clazz, DynamoDBQueryExpression<T> queryExpression, DynamoDBMapperConfig config) { config = mergeConfig(config); QueryRequest queryRequest = createQueryRequestFromExpression(clazz, queryExpression, config); QueryResult queryResult = db.query(applyUserAgent(queryRequest)); QueryResultPage<T> result = new QueryResultPage<T>(); List<AttributeTransformer.Parameters<T>> parameters = toParameters(queryResult.getItems(), clazz, queryRequest.getTableName(), config); result.setResults(marshallIntoObjects(parameters)); result.setLastEvaluatedKey(queryResult.getLastEvaluatedKey()); result.setCount(queryResult.getCount()); result.setScannedCount(queryResult.getScannedCount()); result.setConsumedCapacity(queryResult.getConsumedCapacity()); return result; }