Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scanning with returnConsumedCapacity returns PaginatedScanList which does not surface consumedCapacity #2707

Closed
christi-square opened this issue Feb 7, 2022 · 4 comments
Labels
feature-request A feature should be added or improved.

Comments

@christi-square
Copy link

Describe the bug

I am using DynamoDBMapper.scan(Class<T>, DynamoDBScanExpression) which returns a PaginatedScanList. When I create the scan expression, if I set returnConsumedCapacity, there is no way to get the value of the consumed capacity because it is hidden in a private field and not surfaced.

Expected behavior

I expected that I would be able to read consumedCapacity from the result of the scan.

Current behavior

The result of the scan is hidden in a private variable and consumedCapacity is not surfaced. If I debug and look at private variables, I can see the consumed capacity is set:

Screen Shot 2022-02-07 at 4 47 16 PM

Steps to Reproduce

    val scanExpression = DynamoDBScanExpression()
      .withFilterExpression("<my filter>")
      .withReturnConsumedCapacity(ReturnConsumedCapacity.INDEXES)
    val scanResponse = this.ddbMapper.scan(CaDefinitionModel::class.java, scanExpression)
    val consumedCapacity = scanResponse.scanResult.consumedCapacity

Possible Solution

I think the PaginatedScanList class should surface a consumedCapacity property which returns the sum of consumedCapacity from each scanResult fetched. So, the total consumed capacity thus far would be returned.

Context

I wanted to report on consumed capacity for a job I am writing so we can estimate costs.

AWS Java SDK version used

aws-java-sdk-dynamodb-1.12.131.jar

JDK version used

openjdk version "11.0.9" 2020-10-20 / OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.9+11) / OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.9+11, mixed mode)

Operating System and version

MacOS Monterey 12.1

@christi-square christi-square added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Feb 7, 2022
@debora-ito debora-ito self-assigned this Feb 10, 2022
@debora-ito
Copy link
Member

Hi @christi-square thank you for reaching out.

We had a pretty similar request (#1170) for load, save and delete item. We ended up implementing those in the Java SDK v2 DynamoDB Enhanced Client, not in the V1 DynamoDB Mapper.

This request will probably have the same path, since we are prioritizing work for SDK V2. Scan does not return consumedCapacity currently, so it would be a feature request too.

Let us know if you'd like to open a feature request in Java SDK v2 for this.

@debora-ito debora-ito added feature-request A feature should be added or improved. response-requested Waiting on additional info or feedback. Will move to "closing-soon" in 5 days. and removed bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Feb 10, 2022
@christi-square
Copy link
Author

Hmm, I didn't realize there was a v2. Yes, that would be great if you could open a ticket there. I don't know when I'll be able to upgrade to v2 to get sample code but if I can manage it soon, I will provide an example.

@github-actions github-actions bot removed the response-requested Waiting on additional info or feedback. Will move to "closing-soon" in 5 days. label Feb 10, 2022
@debora-ito debora-ito removed their assignment Jun 9, 2023
@debora-ito
Copy link
Member

We don't have plans to add this to v1 before going into Maintenance Mode.

ConsumedCapacity is supported in query and scan responses in the v2 DynamoDB Enhanced Client. Please migrate to Java SDK v2 if you have a chance, and open a new issue in the v2 repo with questions or feedbacks.

Reference:

  • Announcing end-of-support for AWS SDK for Java v1.x effective December 31, 2025 - blog post

@debora-ito debora-ito closed this as not planned Won't fix, can't repro, duplicate, stale Jul 26, 2024
Copy link

This issue is now closed.

Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved.
Projects
None yet
Development

No branches or pull requests

2 participants