-
Notifications
You must be signed in to change notification settings - Fork 311
DATACASS-529 - Allow slice queries using reactive repositories. #128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Thanks a lot, we'll take a look as soon as we have time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a few comments to this pull request. Do you want to address these issues from your side or should we take your pull request from here and apply the changes ourselves?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't introduce dependencies to reactive types here as we want the module to run without reactive dependencies as well.
We also need to be careful about fetching/reading progress. If the fetch size differs from the actual number of rows returned for a page, we might request the next page without intending to do so. I think we need another method on ReactiveResultSet that gives us a Flux without transparent next page fetching.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, we're mixing paradigms. We should return an empty Slice (see Page.empty()) as the query terminates without rows and the query result is the container for rows, not the rows themselves.
Hi @mp911de,
I have no free time in near future, so if you can finish this task, it would be nice. Thanks
Cool, thanks for your timely update. We'll take care of this one.
eximius313
commented
Jun 12, 2018
@mp911de do you have any plans when you could handle this?
This pull request needs some polishing before we can merge it. We intend to ship the change with the next release candidate.
eximius313
commented
Jun 12, 2018
So 2.1.0.RC1?
lukasz-gosiewski
commented
Jun 12, 2018
@mp911de
That's some nice news, but there's one problem with this approach. CassandraPageRequest returned by Slice object has no option of serialization. Therefore we cannot use it easily in web layer. Underlying PagingState, however, is easily serializable with toString method. Shouldn't CassandraPageRequst expose this functionality as well?
@lukasz-gosiewski Please file a new ticket in Spring Data Cassandra. We'll see what we can do for you.
We now support Slice queries using reactive Cassandra repositories. Repository query methods can declare Mono<Slice<T>> as their return type to query for slices without applying transparent paging. The resulting Mono always completes with a value. An empty query result returns a Mono emitting an empty Slice.
interface UserRepository extends CrudRepository<User, String> {
Mono<Slice<User>> findByLastname(String firstname, Pageable pageable);
}
Mono<Slice<User>> result =repository.findByLastname("White", CassandraPageRequest.first(1));
Original pull request: #128.
Introduce ReactiveResultSet.availableRows() to fetch rows without transparent paging. Refactor QueryUtils to extract a Slice from an Iterable. Add slice(Query, Class) to ReactiveCassandraOperations to expose a consistent API. Convert space indentation to tab indentation. Add tests. Add since tags. Add documentation. Reformat code. Original pull request: #128.
That's merged and polished now. Thanks a lot!
Uh oh!
There was an error while loading. Please reload this page.
Reactive repositories now support methods returning
Mono<Slice<T>>.Related ticket: DATACASS-529.