Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions query/src/main/java/tech/ydb/query/QueryStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import tech.ydb.core.Issue;
import tech.ydb.core.Result;
import tech.ydb.proto.ValueProtos;
import tech.ydb.query.result.QueryInfo;
import tech.ydb.query.result.QueryResultPart;

Expand All @@ -15,9 +16,16 @@
*/
@ExperimentalApi("QueryService is experimental and API may change without notice")
public interface QueryStream {

@FunctionalInterface
interface PartsHandler {
default void onIssues(Issue[] issues) { }

void onNextPart(QueryResultPart part);

default void onNextRawPart(long index, ValueProtos.ResultSet rs) {
onNextPart(new QueryResultPart(index, rs));
}
}

CompletableFuture<Result<QueryInfo>> execute(PartsHandler handler);
Expand Down
3 changes: 1 addition & 2 deletions query/src/main/java/tech/ydb/query/impl/SessionImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import tech.ydb.query.QueryStream;
import tech.ydb.query.QueryTransaction;
import tech.ydb.query.result.QueryInfo;
import tech.ydb.query.result.QueryResultPart;
import tech.ydb.query.result.QueryStats;
import tech.ydb.query.settings.AttachSessionSettings;
import tech.ydb.query.settings.BeginTransactionSettings;
Expand Down Expand Up @@ -304,7 +303,7 @@ public CompletableFuture<Result<QueryInfo>> execute(PartsHandler handler) {
if (msg.hasResultSet()) {
long index = msg.getResultSetIndex();
if (handler != null) {
handler.onNextPart(new QueryResultPart(index, msg.getResultSet()));
handler.onNextRawPart(index, msg.getResultSet());
} else {
logger.trace("{} lost result set part with index {}", SessionImpl.this, index);
}
Expand Down