spring-data-dynamodb icon indicating copy to clipboard operation
spring-data-dynamodb copied to clipboard

IN operator and Order By falls back to Scan

Open shemekh opened this issue 5 years ago • 1 comments

Expected Behavior

I have a paging repository as follows:

public interface PagingMessageLogRepository extends PagingAndSortingRepository<MessageLog, MessageLogId> {
	Page<MessageLog> findByInstanceIdOrderByInsertedDateDesc(Long instanceId, Pageable pageable);
	Page<MessageLog> findByInstanceIdInOrderByInsertedDateDesc(List<Long> instanceId, Pageable pageable);
}

instanceId - Hash key insertedDate - Range key

Problem is with the second method that uses IN operator.

Actual Behavior

First method works as expected and returns MessageLog objects with provided instanceId. Second method is not working properly and throws error. Surprisingly it falls back to Scan instead of performing Query. Thrown error is: Sorting not supported for scan expressions..

Steps to Reproduce the Problem

  1. Self explanatory based on above sections.

Specifications

  • Spring Data DynamoDB Version: 4.5.7 (2.0)
  • Spring Boot Version: 1.5.15.RELEASE
  • AWS SDK Version: 1.11.892
  • Java Version: 1.8.0_261 - Java HotSpot(TM) 64-Bit Server VM 25.261-b12
  • Platform Details: Windows 10 10.0

shemekh avatar Dec 15 '20 18:12 shemekh

@derjust

xirupem avatar Jul 21 '22 23:07 xirupem