public class BigQueryDirectDataWriterHelper extends Object
| Constructor and Description |
|---|
BigQueryDirectDataWriterHelper(BigQueryClientFactory writeClientFactory,
String tablePath,
com.google.cloud.bigquery.storage.v1.ProtoSchema protoSchema,
com.google.api.gax.retrying.RetrySettings bigqueryDataWriterHelperRetrySettings,
com.google.common.base.Optional<String> traceId,
int partitionId,
boolean writeAtLeastOnce) |
| Modifier and Type | Method and Description |
|---|---|
void |
abort()
Deletes the data left over in the protoRows, using method clearProtoRows, closes the
StreamWriter, shuts down the WriteClient, and nulls out the protoRows and write-stream-name.
|
void |
addRow(com.google.protobuf.ByteString message)
Adds a row to the protoRows, which acts as a buffer; but before, checks if the current message
size in bytes will cause the protoRows buffer to exceed the maximum APPEND_REQUEST_SIZE, and if
it will, sends an append rows request first.
|
WriteStreamStatistics |
finalizeStream()
Appends any data that remains in the protoRows, waits for 500 milliseconds, and finalizes the
write-stream.
|
String |
getWriteStreamName() |
public BigQueryDirectDataWriterHelper(BigQueryClientFactory writeClientFactory, String tablePath, com.google.cloud.bigquery.storage.v1.ProtoSchema protoSchema, com.google.api.gax.retrying.RetrySettings bigqueryDataWriterHelperRetrySettings, com.google.common.base.Optional<String> traceId, int partitionId, boolean writeAtLeastOnce)
public void addRow(com.google.protobuf.ByteString message)
throws IOException
message - The row, in a ByteString message, to be added to protoRows.IOException - If sendAppendRowsRequest fails.this#sendAppendRowsRequest()public WriteStreamStatistics finalizeStream() throws IOException
finalizeStream().IOException - If the row-count returned by the FinalizeWriteStreamResponse does not match
the expected offset (which is equal to the number of rows appended thus far).this#writeStreamRowCountpublic void abort()
commit().public String getWriteStreamName()
Copyright © 2024. All rights reserved.