From b705783d5939c1df96dc565cb763365e1989adb6 Mon Sep 17 00:00:00 2001 From: Veronica Wasson <3992422+VeronicaWasson@users.noreply.github.com> Date: Mon, 18 Oct 2021 11:46:14 -0700 Subject: [PATCH] docs(samples): Update samples to v1 (#1364) Co-authored-by: Veronica Wasson <3992422+MikeWasson@users.noreply.github.com> --- .../BqToBqStorageSchemaConverter.java | 4 +-- .../ParallelWriteCommittedStream.java | 26 +++++++++---------- .../bigquerystorage/WriteBufferedStream.java | 16 ++++++------ .../bigquerystorage/WriteCommittedStream.java | 12 ++++----- .../bigquerystorage/WritePendingStream.java | 20 +++++++------- .../bigquerystorage/WriteToDefaultStream.java | 8 +++--- 6 files changed, 43 insertions(+), 43 deletions(-) diff --git a/samples/snippets/src/main/java/com/example/bigquerystorage/BqToBqStorageSchemaConverter.java b/samples/snippets/src/main/java/com/example/bigquerystorage/BqToBqStorageSchemaConverter.java index 27a33b93df..27c5d1dbcb 100644 --- a/samples/snippets/src/main/java/com/example/bigquerystorage/BqToBqStorageSchemaConverter.java +++ b/samples/snippets/src/main/java/com/example/bigquerystorage/BqToBqStorageSchemaConverter.java @@ -19,8 +19,8 @@ import com.google.cloud.bigquery.Field; import com.google.cloud.bigquery.Schema; import com.google.cloud.bigquery.StandardSQLTypeName; -import com.google.cloud.bigquery.storage.v1beta2.TableFieldSchema; -import com.google.cloud.bigquery.storage.v1beta2.TableSchema; +import com.google.cloud.bigquery.storage.v1.TableFieldSchema; +import com.google.cloud.bigquery.storage.v1.TableSchema; import com.google.common.collect.ImmutableMap; /** Converts structure from BigQuery client to BigQueryStorage client */ diff --git a/samples/snippets/src/main/java/com/example/bigquerystorage/ParallelWriteCommittedStream.java b/samples/snippets/src/main/java/com/example/bigquerystorage/ParallelWriteCommittedStream.java index ac6cafc966..a70b7da8fb 100644 --- a/samples/snippets/src/main/java/com/example/bigquerystorage/ParallelWriteCommittedStream.java +++ b/samples/snippets/src/main/java/com/example/bigquerystorage/ParallelWriteCommittedStream.java @@ -20,17 +20,17 @@ import com.google.api.core.ApiFuture; import com.google.api.core.ApiFutureCallback; import com.google.api.core.ApiFutures; -import com.google.cloud.bigquery.storage.v1beta2.AppendRowsResponse; -import com.google.cloud.bigquery.storage.v1beta2.BQTableSchemaToProtoDescriptor; -import com.google.cloud.bigquery.storage.v1beta2.BigQueryWriteClient; -import com.google.cloud.bigquery.storage.v1beta2.CreateWriteStreamRequest; -import com.google.cloud.bigquery.storage.v1beta2.JsonToProtoMessage; -import com.google.cloud.bigquery.storage.v1beta2.ProtoRows; -import com.google.cloud.bigquery.storage.v1beta2.ProtoSchema; -import com.google.cloud.bigquery.storage.v1beta2.ProtoSchemaConverter; -import com.google.cloud.bigquery.storage.v1beta2.StreamWriterV2; -import com.google.cloud.bigquery.storage.v1beta2.TableName; -import com.google.cloud.bigquery.storage.v1beta2.WriteStream; +import com.google.cloud.bigquery.storage.v1.AppendRowsResponse; +import com.google.cloud.bigquery.storage.v1.BQTableSchemaToProtoDescriptor; +import com.google.cloud.bigquery.storage.v1.BigQueryWriteClient; +import com.google.cloud.bigquery.storage.v1.CreateWriteStreamRequest; +import com.google.cloud.bigquery.storage.v1.JsonToProtoMessage; +import com.google.cloud.bigquery.storage.v1.ProtoRows; +import com.google.cloud.bigquery.storage.v1.ProtoSchema; +import com.google.cloud.bigquery.storage.v1.ProtoSchemaConverter; +import com.google.cloud.bigquery.storage.v1.StreamWriter; +import com.google.cloud.bigquery.storage.v1.TableName; +import com.google.cloud.bigquery.storage.v1.WriteStream; import com.google.common.util.concurrent.MoreExecutors; import com.google.protobuf.Descriptors.Descriptor; import com.google.protobuf.Descriptors.DescriptorValidationException; @@ -161,8 +161,8 @@ private void writeToStream( BQTableSchemaToProtoDescriptor.convertBQTableSchemaToProtoDescriptor( writeStream.getTableSchema()); ProtoSchema protoSchema = ProtoSchemaConverter.convert(descriptor); - try (StreamWriterV2 writer = - StreamWriterV2.newBuilder(writeStream.getName()) + try (StreamWriter writer = + StreamWriter.newBuilder(writeStream.getName()) .setWriterSchema(protoSchema) .setTraceId("SAMPLE:parallel_append") .build()) { diff --git a/samples/snippets/src/main/java/com/example/bigquerystorage/WriteBufferedStream.java b/samples/snippets/src/main/java/com/example/bigquerystorage/WriteBufferedStream.java index 18a426621d..da9be978cb 100644 --- a/samples/snippets/src/main/java/com/example/bigquerystorage/WriteBufferedStream.java +++ b/samples/snippets/src/main/java/com/example/bigquerystorage/WriteBufferedStream.java @@ -18,14 +18,14 @@ // [START bigquerystorage_jsonstreamwriter_buffered] import com.google.api.core.ApiFuture; -import com.google.cloud.bigquery.storage.v1beta2.AppendRowsResponse; -import com.google.cloud.bigquery.storage.v1beta2.BigQueryWriteClient; -import com.google.cloud.bigquery.storage.v1beta2.CreateWriteStreamRequest; -import com.google.cloud.bigquery.storage.v1beta2.FlushRowsRequest; -import com.google.cloud.bigquery.storage.v1beta2.FlushRowsResponse; -import com.google.cloud.bigquery.storage.v1beta2.JsonStreamWriter; -import com.google.cloud.bigquery.storage.v1beta2.TableName; -import com.google.cloud.bigquery.storage.v1beta2.WriteStream; +import com.google.cloud.bigquery.storage.v1.AppendRowsResponse; +import com.google.cloud.bigquery.storage.v1.BigQueryWriteClient; +import com.google.cloud.bigquery.storage.v1.CreateWriteStreamRequest; +import com.google.cloud.bigquery.storage.v1.FlushRowsRequest; +import com.google.cloud.bigquery.storage.v1.FlushRowsResponse; +import com.google.cloud.bigquery.storage.v1.JsonStreamWriter; +import com.google.cloud.bigquery.storage.v1.TableName; +import com.google.cloud.bigquery.storage.v1.WriteStream; import com.google.protobuf.Descriptors.DescriptorValidationException; import com.google.protobuf.Int64Value; import java.io.IOException; diff --git a/samples/snippets/src/main/java/com/example/bigquerystorage/WriteCommittedStream.java b/samples/snippets/src/main/java/com/example/bigquerystorage/WriteCommittedStream.java index 63ff782924..016bed8ddb 100644 --- a/samples/snippets/src/main/java/com/example/bigquerystorage/WriteCommittedStream.java +++ b/samples/snippets/src/main/java/com/example/bigquerystorage/WriteCommittedStream.java @@ -18,12 +18,12 @@ // [START bigquerystorage_jsonstreamwriter_committed] import com.google.api.core.ApiFuture; -import com.google.cloud.bigquery.storage.v1beta2.AppendRowsResponse; -import com.google.cloud.bigquery.storage.v1beta2.BigQueryWriteClient; -import com.google.cloud.bigquery.storage.v1beta2.CreateWriteStreamRequest; -import com.google.cloud.bigquery.storage.v1beta2.JsonStreamWriter; -import com.google.cloud.bigquery.storage.v1beta2.TableName; -import com.google.cloud.bigquery.storage.v1beta2.WriteStream; +import com.google.cloud.bigquery.storage.v1.AppendRowsResponse; +import com.google.cloud.bigquery.storage.v1.BigQueryWriteClient; +import com.google.cloud.bigquery.storage.v1.CreateWriteStreamRequest; +import com.google.cloud.bigquery.storage.v1.JsonStreamWriter; +import com.google.cloud.bigquery.storage.v1.TableName; +import com.google.cloud.bigquery.storage.v1.WriteStream; import com.google.protobuf.Descriptors.DescriptorValidationException; import java.io.IOException; import java.util.concurrent.ExecutionException; diff --git a/samples/snippets/src/main/java/com/example/bigquerystorage/WritePendingStream.java b/samples/snippets/src/main/java/com/example/bigquerystorage/WritePendingStream.java index 386f08a5d0..a712bcbc4a 100644 --- a/samples/snippets/src/main/java/com/example/bigquerystorage/WritePendingStream.java +++ b/samples/snippets/src/main/java/com/example/bigquerystorage/WritePendingStream.java @@ -18,16 +18,16 @@ // [START bigquerystorage_jsonstreamwriter_pending] import com.google.api.core.ApiFuture; -import com.google.cloud.bigquery.storage.v1beta2.AppendRowsResponse; -import com.google.cloud.bigquery.storage.v1beta2.BatchCommitWriteStreamsRequest; -import com.google.cloud.bigquery.storage.v1beta2.BatchCommitWriteStreamsResponse; -import com.google.cloud.bigquery.storage.v1beta2.BigQueryWriteClient; -import com.google.cloud.bigquery.storage.v1beta2.CreateWriteStreamRequest; -import com.google.cloud.bigquery.storage.v1beta2.FinalizeWriteStreamResponse; -import com.google.cloud.bigquery.storage.v1beta2.JsonStreamWriter; -import com.google.cloud.bigquery.storage.v1beta2.StorageError; -import com.google.cloud.bigquery.storage.v1beta2.TableName; -import com.google.cloud.bigquery.storage.v1beta2.WriteStream; +import com.google.cloud.bigquery.storage.v1.AppendRowsResponse; +import com.google.cloud.bigquery.storage.v1.BatchCommitWriteStreamsRequest; +import com.google.cloud.bigquery.storage.v1.BatchCommitWriteStreamsResponse; +import com.google.cloud.bigquery.storage.v1.BigQueryWriteClient; +import com.google.cloud.bigquery.storage.v1.CreateWriteStreamRequest; +import com.google.cloud.bigquery.storage.v1.FinalizeWriteStreamResponse; +import com.google.cloud.bigquery.storage.v1.JsonStreamWriter; +import com.google.cloud.bigquery.storage.v1.StorageError; +import com.google.cloud.bigquery.storage.v1.TableName; +import com.google.cloud.bigquery.storage.v1.WriteStream; import com.google.protobuf.Descriptors.DescriptorValidationException; import java.io.IOException; import java.util.concurrent.ExecutionException; 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 a06b113b3b..4142f9bc9b 100644 --- a/samples/snippets/src/main/java/com/example/bigquerystorage/WriteToDefaultStream.java +++ b/samples/snippets/src/main/java/com/example/bigquerystorage/WriteToDefaultStream.java @@ -22,10 +22,10 @@ import com.google.cloud.bigquery.BigQueryOptions; import com.google.cloud.bigquery.Schema; import com.google.cloud.bigquery.Table; -import com.google.cloud.bigquery.storage.v1beta2.AppendRowsResponse; -import com.google.cloud.bigquery.storage.v1beta2.JsonStreamWriter; -import com.google.cloud.bigquery.storage.v1beta2.TableName; -import com.google.cloud.bigquery.storage.v1beta2.TableSchema; +import com.google.cloud.bigquery.storage.v1.AppendRowsResponse; +import com.google.cloud.bigquery.storage.v1.JsonStreamWriter; +import com.google.cloud.bigquery.storage.v1.TableName; +import com.google.cloud.bigquery.storage.v1.TableSchema; import com.google.protobuf.Descriptors.DescriptorValidationException; import java.io.IOException; import java.util.concurrent.ExecutionException;