Skip to content

Commit 2a0c343

Browse files
committed
chore: Fixup
1 parent 372902b commit 2a0c343

2 files changed

Lines changed: 4 additions & 11 deletions

File tree

jdbc-core/src/main/java/com/salesforce/datacloud/jdbc/protocol/async/AsyncQueryResultIterator.java

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -167,18 +167,9 @@ private CompletionStage<Optional<QueryResult>> pollForMoreChunks() {
167167
return pollForMoreChunks();
168168
}
169169
}
170-
// Info stream ended, check if we're done
171-
boolean queryIsDone = queryStatus != null
172-
&& ((queryStatus.getCompletionStatus() == QueryStatus.CompletionStatus.FINISHED)
173-
|| (queryStatus.getCompletionStatus() == QueryStatus.CompletionStatus.RESULTS_PRODUCED));
174-
boolean allChunksConsumed =
175-
(queryStatus == null || nextChunk >= queryStatus.getChunkCount()) && (chunkIterator == null);
176-
177-
if (queryIsDone && allChunksConsumed) {
178-
return CompletableFuture.completedFuture(Optional.empty());
179-
}
180170

181-
// This should never happen
171+
// This should never happen, callers of pollForMoreChunks should not call it when the query is already
172+
// finished
182173
CompletableFuture<Optional<QueryResult>> future = new CompletableFuture<>();
183174
future.completeExceptionally(new RuntimeException("Unexpected end in next()"));
184175
return future;

jdbc-core/src/main/java/com/salesforce/datacloud/jdbc/protocol/async/core/AsyncStreamObserver.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,5 +185,7 @@ public void close() {
185185
if (stream != null) {
186186
stream.cancel("Call got closed by the client.", null);
187187
}
188+
// We don't check if the pendingFuture is sethere intentionally. The close propagates through the gRPC layer
189+
// and the pendingFuture will be completed with an error in the onError callback.
188190
}
189191
}

0 commit comments

Comments
 (0)