[ 
https://issues.apache.org/jira/browse/IGNITE-17068?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Konstantin Orlov updated IGNITE-17068:
--------------------------------------
    Description: 
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}

  was:AsyncResultSet.fetchNextPage has different semantics on client (returns 
same instance) and server (return new instance)


> 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
>
> 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)

Reply via email to