From 63cb1159b52e885735211b500080840a44e1c46f Mon Sep 17 00:00:00 2001 From: Yiru Tang Date: Mon, 3 Apr 2023 17:49:28 +0000 Subject: [PATCH] . --- .../com/example/bigquerystorage/WriteToDefaultStream.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/samples/snippets/src/main/java/com/example/bigquerystorage/WriteToDefaultStream.java b/samples/snippets/src/main/java/com/example/bigquerystorage/WriteToDefaultStream.java index ca33ad5237..ef7ae6d081 100644 --- a/samples/snippets/src/main/java/com/example/bigquerystorage/WriteToDefaultStream.java +++ b/samples/snippets/src/main/java/com/example/bigquerystorage/WriteToDefaultStream.java @@ -151,7 +151,8 @@ public void initialize(TableName parentTable) // For more information about JsonStreamWriter, see: // https://googleapis.dev/java/google-cloud-bigquerystorage/latest/com/google/cloud/bigquery/storage/v1/JsonStreamWriter.html streamWriter = - JsonStreamWriter.newBuilder(parentTable.toString(), BigQueryWriteClient.create()).build(); + JsonStreamWriter.newBuilder(streamWriter.getStreamName(), + BigQueryWriteClient.create()).build(); } public void append(AppendContext appendContext) @@ -163,7 +164,7 @@ public void append(AppendContext appendContext) // If stream writer is premenantly failed, try recreate a stream writer. if (streamWriter.isClosed() && recreateCount.getAndIncrement() < MAX_RECREATE_COUNT) { streamWriter = - JsonStreamWriter.newBuilder(parentTable.toString(), + JsonStreamWriter.newBuilder(streamWriter.get, BigQueryWriteClient.create()).build(); this.error = null; }