[
https://issues.apache.org/jira/browse/IGNITE-17068?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Taras Ledkov resolved IGNITE-17068.
-----------------------------------
Resolution: Fixed
Merged to
[main|https://github.com/apache/ignite-3/commit/da2738b575c0278bbbb64b85fa89198931faa17f]
> Sql: Fix AsyncResultSet.fetchNextPage semantics
> -----------------------------------------------
>
> Key: IGNITE-17068
> URL: https://issues.apache.org/jira/browse/IGNITE-17068
> Project: Ignite
> Issue Type: Bug
> Components: sql
> Reporter: Pavel Tupitsyn
> Assignee: Taras Ledkov
> Priority: Major
> Labels: ignite-3
> Time Spent: 10m
> Remaining Estimate: 0h
>
> AsyncResultSet.fetchNextPage has different semantics on client (returns same
> instance) and server (return new instance).
> Since the behavior on the client seems to be more correct, let's bring the
> server implementation in line: call to {{fetchNextPage}} should return the
> same instance of {{AsyncResultSet}} but with updated state.
> Also let's add to the javadoc the proper way to drain the cursor to a
> collection:
> {code:java}
> CompletionStage<Void> fetchAllRowsInto(AsyncResultSet resultSet, List<SqlRow>
> target) {
> for (var row : resultSet.currentPage()) {
> target.add(row);
> }
> if (!resultSet.hasMorePages()) {
> return CompletableFuture.completedFuture(null);
> }
> return resultSet.fetchNextPage().thenCompose(res -> fetchAllRowsInto(res,
> target));
> } {code}
--
This message was sent by Atlassian Jira
(v8.20.7#820007)