DynamoDB enhanced client index.query() returns SdkIterable instead of PageIterable
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 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();
Stumbled upon the same problem. Definitely looks like a bug, at least in the documentation.
+1 for the described issue.
+1 issues is still not fixed and the docs example does not work.
Please don't comment with +1s, they are not helpful. Add your upvote to the original issue.
Documentation was fixed via #2529. Closing.
⚠️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.