derjust / spring-data-dynamodb

This module deals with enhanced support for a data access layer built on AWS DynamoDB.
https://derjust.github.io/spring-data-dynamodb/
Apache License 2.0
402 stars 141 forks source link

When 'findBy' method is annotated with @EnableScan or on class level, and the method uses only hash key (and range key), the method still executes scan instead of query. There is only a check if the used fields are GSI, but no checks if all the fields are hash/range keys. #296

Open diyan-gochev-at-ft-dot-com opened 2 years ago

diyan-gochev-at-ft-dot-com commented 2 years ago

Expected Behavior

  1. If we have a method findA and A is a hash key or
  2. We have a method findAAndB and A is a hash kay and B is range-key

Query op should be executed.

Actual Behavior

Scan op has been executed.

Steps to Reproduce the Problem

Scenario 1.

  1. Define only hash-key, declare method findByA where A is a hash key; Scenario 2:
  2. Define hash key and range key, declare method findAAndB where A is a hash key and B is a range key;

There is only a check if the used fields are GSI, but no checks if all the fields are hash/range keys.

xirupem commented 2 years ago

I'm having the same problem when trying to use a search on the Partition Key, passing a list of elements and using the IN operator.

Eg: Page findAllByHashKeyIn(List hashKeyList, Pageable pageable);

xirupem commented 2 years ago

@derjust