aws-sdk-java-v2 icon indicating copy to clipboard operation
aws-sdk-java-v2 copied to clipboard

DynamoDB enhanced client index.query() returns SdkIterable instead of PageIterable

Open superwese opened this issue 5 years ago • 7 comments

Describe the issue

The README states that querying an index returns a PageIterable.

DynamoDbIndex<Customer> customersByName = customerTable.index("customers_by_name");    
PageIterable<Customer> customersWithName = 
    customersByName.query(r -> r.queryConditional(**keyEqualTo**(k -> k.partitionValue("Smith"))));

When I try to do this, my IDE complains

Required type: PageIterable<Customer>
Provided: SdkIterable<Page<Customer>>

Which is kind of strange because public interface PageIterable<T> extends SdkIterable<Page<T>>

I can circumvent this by using PageIterable.create(index.query())

I am wondering if this is a documentation issue, a bug or me doing something wrong. I'd prefer being this a bug, because index.query() should behave like table.query().

Any help is appreciated.

Thanks Frank

Links

https://github.com/aws/aws-sdk-java-v2/blob/master/services-custom/dynamodb-enhanced/README.md

superwese avatar Dec 04 '20 18:12 superwese

@superwese I can see it too, I will investigate.

Another way to work around it is:

Iterator<Page<Customer>> customersWithName =  
        customersByName.query(r -> r.queryConditional(keyEqualTo(k -> k.partitionValue("Smith"))))
        .iterator();

debora-ito avatar Dec 09 '20 02:12 debora-ito

Stumbled upon the same problem. Definitely looks like a bug, at least in the documentation.

bigunyak avatar Dec 21 '20 17:12 bigunyak

+1 for the described issue.

RushinNaik avatar Apr 07 '21 08:04 RushinNaik

+1 issues is still not fixed and the docs example does not work.

pacosw1 avatar Apr 07 '21 13:04 pacosw1

Please don't comment with +1s, they are not helpful. Add your upvote to the original issue.

debora-ito avatar Apr 07 '21 22:04 debora-ito

Documentation was fixed via #2529. Closing.

debora-ito avatar Jun 23 '21 00:06 debora-ito

⚠️COMMENT VISIBILITY WARNING⚠️

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. If you wish to keep having a conversation with other community members under this issue feel free to do so.

github-actions[bot] avatar Jun 23 '21 00:06 github-actions[bot]