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
403 stars 141 forks source link

IN operator and Order By falls back to Scan #292

Open shemekh opened 3 years ago

shemekh commented 3 years ago

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

xirupem commented 2 years ago

@derjust