com.amazonaws.services.dynamodbv2.model.QueryRequest.getSelect()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(13.6k)|赞(0)|评价(0)|浏览(71)

本文整理了Java中com.amazonaws.services.dynamodbv2.model.QueryRequest.getSelect方法的一些代码示例,展示了QueryRequest.getSelect的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。QueryRequest.getSelect方法的具体详情如下:
包路径:com.amazonaws.services.dynamodbv2.model.QueryRequest
类名称:QueryRequest
方法名:getSelect

QueryRequest.getSelect介绍

[英]The attributes to be returned in the result. You can retrieve all item attributes, specific item attributes, the count of matching items, or in the case of an index, some or all of the attributes projected into the index.

  • ALL_ATTRIBUTES - Returns all of the item attributes from the specified table or index. If you query a local secondary index, then for each matching item in the index DynamoDB will fetch the entire item from the parent table. If the index is configured to project all item attributes, then all of the data can be obtained from the local secondary index, and no fetching is required.
  • ALL_PROJECTED_ATTRIBUTES - Allowed only when querying an index. Retrieves all attributes that have been projected into the index. If the index is configured to project all attributes, this return value is equivalent to specifying ALL_ATTRIBUTES.
  • COUNT - Returns the number of matching items, rather than the matching items themselves.
  • SPECIFIC_ATTRIBUTES - Returns only the attributes listed in AttributesToGet. This return value is equivalent to specifying AttributesToGet without specifying any value for Select.

If you query or scan a local secondary index and request only attributes that are projected into that index, the operation will read only the index and not the table. If any of the requested attributes are not projected into the local secondary index, DynamoDB will fetch each of these attributes from the parent table. This extra fetching incurs additional throughput cost and latency.

If you query or scan a global secondary index, you can only request attributes that are projected into the index. Global secondary index queries cannot fetch attributes from the parent table.

If neither Select nor AttributesToGet are specified, DynamoDB defaults to ALL_ATTRIBUTES when accessing a table, and ALL_PROJECTED_ATTRIBUTES when accessing an index. You cannot use both Select and AttributesToGet together in a single request, unless the value for Select is SPECIFIC_ATTRIBUTES. (This usage is equivalent to specifying AttributesToGet without any value for Select.)

If you use the ProjectionExpression parameter, then the value for Select can only be SPECIFIC_ATTRIBUTES. Any other value for Select will return an error.

Constraints:
Allowed Values: ALL_ATTRIBUTES, ALL_PROJECTED_ATTRIBUTES, SPECIFIC_ATTRIBUTES, COUNT
[中]要在结果中返回的属性。您可以检索所有项目属性、特定项目属性、匹配项目的计数,或者在索引的情况下,检索投影到索引中的部分或全部属性。
*ALL_ATTRIBUTES-返回指定表或索引中的所有项属性。如果查询本地二级索引,那么对于索引中的每个匹配项,DynamoDB将从父表中获取整个项。如果将索引配置为投影所有项属性,则可以从本地二级索引获取所有数据,而无需获取。
*ALL_PROJECTED_ATTRIBUTES-仅在查询索引时才允许。检索已投影到索引中的所有属性。如果将索引配置为投影所有属性,则此返回值相当于指定ALL_ATTRIBUTES
*[$3$]-返回匹配项的数量,而不是匹配项本身。
*SPECIFIC_ATTRIBUTES-仅返回AttributesToGet中列出的属性。此返回值相当于指定AttributesToGet,而不指定Select的任何值。
如果查询或扫描本地二级索引,并仅请求投影到该索引中的属性,则该操作将只读取索引,而不读取表。如果任何请求的属性没有投影到本地二级索引中,DynamoDB将从父表中获取每个属性。这种额外的抓取会带来额外的吞吐量成本和延迟。
如果查询或扫描全局二级索引,则只能请求投影到索引中的属性。全局二级索引查询无法从父表中获取属性。
如果既未指定Select也未指定AttributesToGet,则在访问表时,DynamoDB默认为ALL_ATTRIBUTES,在访问索引时,DynamoDB默认为ALL_PROJECTED_ATTRIBUTES。不能在一个请求中同时使用SelectAttributesToGet,除非Select的值为SPECIFIC_ATTRIBUTES。(此用法相当于指定AttributesToGet而不指定Select的任何值。)
如果使用ProjectionExpression参数,Select的值只能是SPECIFIC_ATTRIBUTESSelect的任何其他值都将返回错误。
限制条件:
允许值:所有属性、所有投影属性、特定属性、计数

代码示例

代码示例来源:origin: aws/aws-sdk-java

public String getSelect() {
  return getRequest().getSelect();
}

代码示例来源:origin: aws/aws-sdk-java

if (getIndexName() != null)
  sb.append("IndexName: ").append(getIndexName()).append(",");
if (getSelect() != null)
  sb.append("Select: ").append(getSelect()).append(",");
if (getAttributesToGet() != null)
  sb.append("AttributesToGet: ").append(getAttributesToGet()).append(",");

代码示例来源:origin: aws/aws-sdk-java

@Override
public int hashCode() {
  final int prime = 31;
  int hashCode = 1;
  hashCode = prime * hashCode + ((getTableName() == null) ? 0 : getTableName().hashCode());
  hashCode = prime * hashCode + ((getIndexName() == null) ? 0 : getIndexName().hashCode());
  hashCode = prime * hashCode + ((getSelect() == null) ? 0 : getSelect().hashCode());
  hashCode = prime * hashCode + ((getAttributesToGet() == null) ? 0 : getAttributesToGet().hashCode());
  hashCode = prime * hashCode + ((getLimit() == null) ? 0 : getLimit().hashCode());
  hashCode = prime * hashCode + ((getConsistentRead() == null) ? 0 : getConsistentRead().hashCode());
  hashCode = prime * hashCode + ((getKeyConditions() == null) ? 0 : getKeyConditions().hashCode());
  hashCode = prime * hashCode + ((getQueryFilter() == null) ? 0 : getQueryFilter().hashCode());
  hashCode = prime * hashCode + ((getConditionalOperator() == null) ? 0 : getConditionalOperator().hashCode());
  hashCode = prime * hashCode + ((getScanIndexForward() == null) ? 0 : getScanIndexForward().hashCode());
  hashCode = prime * hashCode + ((getExclusiveStartKey() == null) ? 0 : getExclusiveStartKey().hashCode());
  hashCode = prime * hashCode + ((getReturnConsumedCapacity() == null) ? 0 : getReturnConsumedCapacity().hashCode());
  hashCode = prime * hashCode + ((getProjectionExpression() == null) ? 0 : getProjectionExpression().hashCode());
  hashCode = prime * hashCode + ((getFilterExpression() == null) ? 0 : getFilterExpression().hashCode());
  hashCode = prime * hashCode + ((getKeyConditionExpression() == null) ? 0 : getKeyConditionExpression().hashCode());
  hashCode = prime * hashCode + ((getExpressionAttributeNames() == null) ? 0 : getExpressionAttributeNames().hashCode());
  hashCode = prime * hashCode + ((getExpressionAttributeValues() == null) ? 0 : getExpressionAttributeValues().hashCode());
  return hashCode;
}

代码示例来源:origin: aws/aws-sdk-java

if (other.getIndexName() != null && other.getIndexName().equals(this.getIndexName()) == false)
  return false;
if (other.getSelect() == null ^ this.getSelect() == null)
  return false;
if (other.getSelect() != null && other.getSelect().equals(this.getSelect()) == false)
  return false;
if (other.getAttributesToGet() == null ^ this.getAttributesToGet() == null)

代码示例来源:origin: aws/aws-sdk-java

/**
 * Marshall the given parameter object.
 */
public void marshall(QueryRequest queryRequest, ProtocolMarshaller protocolMarshaller) {
  if (queryRequest == null) {
    throw new SdkClientException("Invalid argument passed to marshall(...)");
  }
  try {
    protocolMarshaller.marshall(queryRequest.getTableName(), TABLENAME_BINDING);
    protocolMarshaller.marshall(queryRequest.getIndexName(), INDEXNAME_BINDING);
    protocolMarshaller.marshall(queryRequest.getSelect(), SELECT_BINDING);
    protocolMarshaller.marshall(queryRequest.getAttributesToGet(), ATTRIBUTESTOGET_BINDING);
    protocolMarshaller.marshall(queryRequest.getLimit(), LIMIT_BINDING);
    protocolMarshaller.marshall(queryRequest.getConsistentRead(), CONSISTENTREAD_BINDING);
    protocolMarshaller.marshall(queryRequest.getKeyConditions(), KEYCONDITIONS_BINDING);
    protocolMarshaller.marshall(queryRequest.getQueryFilter(), QUERYFILTER_BINDING);
    protocolMarshaller.marshall(queryRequest.getConditionalOperator(), CONDITIONALOPERATOR_BINDING);
    protocolMarshaller.marshall(queryRequest.getScanIndexForward(), SCANINDEXFORWARD_BINDING);
    protocolMarshaller.marshall(queryRequest.getExclusiveStartKey(), EXCLUSIVESTARTKEY_BINDING);
    protocolMarshaller.marshall(queryRequest.getReturnConsumedCapacity(), RETURNCONSUMEDCAPACITY_BINDING);
    protocolMarshaller.marshall(queryRequest.getProjectionExpression(), PROJECTIONEXPRESSION_BINDING);
    protocolMarshaller.marshall(queryRequest.getFilterExpression(), FILTEREXPRESSION_BINDING);
    protocolMarshaller.marshall(queryRequest.getKeyConditionExpression(), KEYCONDITIONEXPRESSION_BINDING);
    protocolMarshaller.marshall(queryRequest.getExpressionAttributeNames(), EXPRESSIONATTRIBUTENAMES_BINDING);
    protocolMarshaller.marshall(queryRequest.getExpressionAttributeValues(), EXPRESSIONATTRIBUTEVALUES_BINDING);
  } catch (Exception e) {
    throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
  }
}

代码示例来源:origin: aws-amplify/aws-sdk-android

if (getIndexName() != null)
  sb.append("IndexName: " + getIndexName() + ",");
if (getSelect() != null)
  sb.append("Select: " + getSelect() + ",");
if (getAttributesToGet() != null)
  sb.append("AttributesToGet: " + getAttributesToGet() + ",");

代码示例来源:origin: aws-amplify/aws-sdk-android

hashCode = prime * hashCode + ((getSelect() == null) ? 0 : getSelect().hashCode());
hashCode = prime * hashCode
    + ((getAttributesToGet() == null) ? 0 : getAttributesToGet().hashCode());

代码示例来源:origin: aws-amplify/aws-sdk-android

&& other.getIndexName().equals(this.getIndexName()) == false)
  return false;
if (other.getSelect() == null ^ this.getSelect() == null)
  return false;
if (other.getSelect() != null && other.getSelect().equals(this.getSelect()) == false)
  return false;
if (other.getAttributesToGet() == null ^ this.getAttributesToGet() == null)

代码示例来源:origin: aws-amplify/aws-sdk-android

jsonWriter.value(indexName);
if (queryRequest.getSelect() != null) {
  String select = queryRequest.getSelect();
  jsonWriter.name("Select");
  jsonWriter.value(select);

代码示例来源:origin: com.amazonaws/aws-java-sdk-dynamodb

public String getSelect() {
  return getRequest().getSelect();
}

代码示例来源:origin: com.amazonaws/aws-java-sdk-dynamodb

if (getIndexName() != null)
  sb.append("IndexName: ").append(getIndexName()).append(",");
if (getSelect() != null)
  sb.append("Select: ").append(getSelect()).append(",");
if (getAttributesToGet() != null)
  sb.append("AttributesToGet: ").append(getAttributesToGet()).append(",");

代码示例来源:origin: com.amazonaws/aws-java-sdk-dynamodb

@Override
public int hashCode() {
  final int prime = 31;
  int hashCode = 1;
  hashCode = prime * hashCode + ((getTableName() == null) ? 0 : getTableName().hashCode());
  hashCode = prime * hashCode + ((getIndexName() == null) ? 0 : getIndexName().hashCode());
  hashCode = prime * hashCode + ((getSelect() == null) ? 0 : getSelect().hashCode());
  hashCode = prime * hashCode + ((getAttributesToGet() == null) ? 0 : getAttributesToGet().hashCode());
  hashCode = prime * hashCode + ((getLimit() == null) ? 0 : getLimit().hashCode());
  hashCode = prime * hashCode + ((getConsistentRead() == null) ? 0 : getConsistentRead().hashCode());
  hashCode = prime * hashCode + ((getKeyConditions() == null) ? 0 : getKeyConditions().hashCode());
  hashCode = prime * hashCode + ((getQueryFilter() == null) ? 0 : getQueryFilter().hashCode());
  hashCode = prime * hashCode + ((getConditionalOperator() == null) ? 0 : getConditionalOperator().hashCode());
  hashCode = prime * hashCode + ((getScanIndexForward() == null) ? 0 : getScanIndexForward().hashCode());
  hashCode = prime * hashCode + ((getExclusiveStartKey() == null) ? 0 : getExclusiveStartKey().hashCode());
  hashCode = prime * hashCode + ((getReturnConsumedCapacity() == null) ? 0 : getReturnConsumedCapacity().hashCode());
  hashCode = prime * hashCode + ((getProjectionExpression() == null) ? 0 : getProjectionExpression().hashCode());
  hashCode = prime * hashCode + ((getFilterExpression() == null) ? 0 : getFilterExpression().hashCode());
  hashCode = prime * hashCode + ((getKeyConditionExpression() == null) ? 0 : getKeyConditionExpression().hashCode());
  hashCode = prime * hashCode + ((getExpressionAttributeNames() == null) ? 0 : getExpressionAttributeNames().hashCode());
  hashCode = prime * hashCode + ((getExpressionAttributeValues() == null) ? 0 : getExpressionAttributeValues().hashCode());
  return hashCode;
}

代码示例来源:origin: com.amazonaws/aws-java-sdk-dynamodb

if (other.getIndexName() != null && other.getIndexName().equals(this.getIndexName()) == false)
  return false;
if (other.getSelect() == null ^ this.getSelect() == null)
  return false;
if (other.getSelect() != null && other.getSelect().equals(this.getSelect()) == false)
  return false;
if (other.getAttributesToGet() == null ^ this.getAttributesToGet() == null)

代码示例来源:origin: com.amazonaws/aws-java-sdk-dynamodb

/**
 * Marshall the given parameter object.
 */
public void marshall(QueryRequest queryRequest, ProtocolMarshaller protocolMarshaller) {
  if (queryRequest == null) {
    throw new SdkClientException("Invalid argument passed to marshall(...)");
  }
  try {
    protocolMarshaller.marshall(queryRequest.getTableName(), TABLENAME_BINDING);
    protocolMarshaller.marshall(queryRequest.getIndexName(), INDEXNAME_BINDING);
    protocolMarshaller.marshall(queryRequest.getSelect(), SELECT_BINDING);
    protocolMarshaller.marshall(queryRequest.getAttributesToGet(), ATTRIBUTESTOGET_BINDING);
    protocolMarshaller.marshall(queryRequest.getLimit(), LIMIT_BINDING);
    protocolMarshaller.marshall(queryRequest.getConsistentRead(), CONSISTENTREAD_BINDING);
    protocolMarshaller.marshall(queryRequest.getKeyConditions(), KEYCONDITIONS_BINDING);
    protocolMarshaller.marshall(queryRequest.getQueryFilter(), QUERYFILTER_BINDING);
    protocolMarshaller.marshall(queryRequest.getConditionalOperator(), CONDITIONALOPERATOR_BINDING);
    protocolMarshaller.marshall(queryRequest.getScanIndexForward(), SCANINDEXFORWARD_BINDING);
    protocolMarshaller.marshall(queryRequest.getExclusiveStartKey(), EXCLUSIVESTARTKEY_BINDING);
    protocolMarshaller.marshall(queryRequest.getReturnConsumedCapacity(), RETURNCONSUMEDCAPACITY_BINDING);
    protocolMarshaller.marshall(queryRequest.getProjectionExpression(), PROJECTIONEXPRESSION_BINDING);
    protocolMarshaller.marshall(queryRequest.getFilterExpression(), FILTEREXPRESSION_BINDING);
    protocolMarshaller.marshall(queryRequest.getKeyConditionExpression(), KEYCONDITIONEXPRESSION_BINDING);
    protocolMarshaller.marshall(queryRequest.getExpressionAttributeNames(), EXPRESSIONATTRIBUTENAMES_BINDING);
    protocolMarshaller.marshall(queryRequest.getExpressionAttributeValues(), EXPRESSIONATTRIBUTEVALUES_BINDING);
  } catch (Exception e) {
    throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
  }
}

代码示例来源:origin: amazon-archives/dynamodb-geo

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;
  }
}

相关文章

微信公众号

最新文章

更多

QueryRequest类方法