zstan commented on code in PR #2906:
URL: https://github.com/apache/ignite-3/pull/2906#discussion_r1434120595
##########
modules/client-handler/src/main/java/org/apache/ignite/client/handler/JdbcQueryCursorHandlerImpl.java:
##########
@@ -91,6 +95,51 @@ public CompletableFuture<JdbcQueryFetchResult>
fetchAsync(JdbcQueryFetchRequest
}).toCompletableFuture();
}
+ /** {@inheritDoc} */
+ @Override
+ public CompletableFuture<JdbcQuerySingleResult>
getMoreResultsAsync(JdbcFetchQueryResultsRequest req) {
+ AsyncSqlCursor<InternalSqlRow> asyncSqlCursor;
+ try {
+ asyncSqlCursor =
resources.get(req.cursorId()).get(AsyncSqlCursor.class);
+ } catch (IgniteInternalCheckedException e) {
+ StringWriter sw = getWriterWithStackTrace(e);
+
+ return CompletableFuture.completedFuture(new
JdbcQuerySingleResult(Response.STATUS_FAILED,
+ "Failed to find query cursor [curId=" + req.cursorId() +
"]. Error message:" + sw));
+ }
+
+ if (!asyncSqlCursor.hasNextResult()) {
+ return CompletableFuture.completedFuture(new
JdbcQuerySingleResult(false, -1));
+ }
+
+ return asyncSqlCursor.closeAsync().thenCompose(c ->
asyncSqlCursor.nextResult())
+ .thenCompose(cur -> cur.requestNextAsync(req.fetchSize())
+ .thenApply(batch -> {
+ try {
+ SqlQueryType queryType = cur.queryType();
+
+ long cursorId = resources.put(new
ClientResource(cur, cur::closeAsync));
+
+ List<ColumnMetadata> columns =
cur.metadata().columns();
+
+ return buildSingleRequest(batch, columns,
cursorId, !batch.hasMore(), queryType);
Review Comment:
done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]