reuvenlax commented on code in PR #23556:
URL: https://github.com/apache/beam/pull/23556#discussion_r1001137870
##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/StorageApiWriteUnshardedRecords.java:
##########
@@ -328,29 +375,62 @@ void addMessage(StorageApiWritePayload payload) throws
Exception {
pendingMessages.add(ByteString.copyFrom(payload.getPayload()));
}
- void flush(RetryManager<AppendRowsResponse, Context<AppendRowsResponse>>
retryManager)
+ long flush(
+ RetryManager<AppendRowsResponse, AppendRowsContext> retryManager,
+ OutputReceiver<BigQueryStorageApiInsertError> failedRowsReceiver)
throws Exception {
if (pendingMessages.isEmpty()) {
- return;
+ return 0;
}
- final ProtoRows.Builder inserts = ProtoRows.newBuilder();
- inserts.addAllSerializedRows(pendingMessages);
- ProtoRows protoRows = inserts.build();
+ final ProtoRows.Builder insertsBuilder = ProtoRows.newBuilder();
+ insertsBuilder.addAllSerializedRows(pendingMessages);
+ final ProtoRows inserts = insertsBuilder.build();
pendingMessages.clear();
+ // Handle the case where the request is too large.
+ if (inserts.getSerializedSize() >= maxRequestSize) {
Review Comment:
Unfortunately it still is.
--
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]