cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ghazi Naceur <ghazi.naceur.cont...@gmail.com>
Subject Re: Paging in Cassandra
Date Wed, 08 Aug 2018 20:08:42 GMT
Hello everyone,

This is the solution :

        @Autowired
        CassandraOperations cassandraOperationsInstance;

.......
.......
Pageable request = CassandraPageRequest.first(1000);
Slice<T> slice = null;
Query query = Query.empty().pageRequest(request);

do {
slice = cassandraOperationsInstance.slice(query, clazz);
if (slice.hasContent()) {
slice.getContent().forEach(s -> {
// treatement ...
});
}
if (slice.hasNext()) {
request = slice.getPageable();
query = query.pageRequest(request);
} else {
break;
}
} while (!slice.getContent().isEmpty());

Best regards.

2018-07-10 14:44 GMT+01:00 Alain RODRIGUEZ <arodrime@gmail.com>:

> Hello,
>
> It sounds like a client/coding issue. People are working with distinct
> clients to connect to Cassandra. And it looks like there are not many
> 'spring-data-cassandra' users around ¯\_(ツ)_/¯.
>
> You could try giving a try there see if you have more luck:
> https://spring.io/questions.
>
> C*heers,
>
> Alain
>
> 2018-07-05 6:21 GMT+01:00 Ghazi Naceur <ghazi.naceur.contact@gmail.com>:
>
>> Hello Eveyone,
>>
>> I'm facing a problem with CassandraPageRequest and Slice<T>.
>> In fact, I'm always obtaining the same Slice and I'm not able to get the
>> next slice (or Page) of data.
>> I'm based on this example :
>>
>> Link : https://github.com/spring-projects/spring-data-cassandra/pull/114
>>
>>
>> Query query = Query.empty().pageRequest(CassandraPageRequest.first(10));Slice<User>
slice = template.slice(query, User.class);
>> do {
>> // consume slice
>> if (slice.hasNext()) {
>> slice = template.select(query, slice.nextPageable(), User.class);
>> } else {break;
>> }
>> } while (!slice.getContent().isEmpty());
>>
>>
>>
>> I appreciate your help.
>>
>
>

Mime
View raw message