You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Mikhail Petrov (Jira)" <ji...@apache.org> on 2022/08/10 11:19:00 UTC
[jira] [Created] (IGNITE-17509) [Extensions] Spring Data pageable request result contains incorrect total value.
Mikhail Petrov created IGNITE-17509:
---------------------------------------
Summary: [Extensions] Spring Data pageable request result contains incorrect total value.
Key: IGNITE-17509
URL: https://issues.apache.org/jira/browse/IGNITE-17509
Project: Ignite
Issue Type: Bug
Reporter: Mikhail Petrov
Attachments: Reproduces_incorrect_pageable_request_total_value_.patch
Assume that Spring Data repository contains the following method
{code:java}
public Page<Person> findByFirstNameContaining(String val, Pageable pageable);
{code}
In this case the following checks will fail
{code:java}
Page<Person> res = repo.findByFirstNameContaining("person", PageRequest.of(2, 100));
assertEquals(CACHE_SIZE, res.getTotalElements());
{code}
where 'repo' is the instance of the previously mention repository.
The full reproduccer is attached.
The main reason of the such behaviour is that IgniteRepositoryQuery.java:614
does not make a separate request of the total rows count and just sets Page 'total' value to 0.
See also org.springframework.data.domain.PageImpl#PageImpl(java.util.List<T>, org.springframework.data.domain.Pageable, long) logic to understand the how the final result of 'getTotalElements()' is calculated.
It seems that as a workaround, you can explicitly request the total number of rows with a separate query.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)