From 3354847a2842f7fd9ab7e6577b26492af26dc6c7 Mon Sep 17 00:00:00 2001 From: yifatgortler Date: Tue, 30 Jul 2024 06:40:22 +0000 Subject: [PATCH] Remove another setter method and some nits. --- .../cloud/bigquery/storage/v1/JsonStreamWriter.java | 1 + .../storage/v1/SchemaAwareStreamWriter.java | 1 + .../cloud/bigquery/storage/v1/StreamWriter.java | 13 +------------ .../cloud/bigquery/storage/v1/StreamWriterTest.java | 8 +------- 4 files changed, 4 insertions(+), 19 deletions(-) diff --git a/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/JsonStreamWriter.java b/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/JsonStreamWriter.java index e11a1729c..f16cee9b5 100644 --- a/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/JsonStreamWriter.java +++ b/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/JsonStreamWriter.java @@ -402,6 +402,7 @@ public Builder setDefaultMissingValueInterpretation( * * @param missingValueInterpretationMap the missing value interpretation map used by the * JsonStreamWriter. + * @return Builder */ public Builder setMissingValueInterpretationMap( Map missingValueInterpretationMap) { diff --git a/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/SchemaAwareStreamWriter.java b/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/SchemaAwareStreamWriter.java index 1ff767a27..0c4b76eba 100644 --- a/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/SchemaAwareStreamWriter.java +++ b/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/SchemaAwareStreamWriter.java @@ -675,6 +675,7 @@ public Builder setDefaultMissingValueInterpretation( * * @param missingValueInterpretationMap the missing value interpretation map used by the * SchemaAwareStreamWriter. + * @return Builder */ public Builder setMissingValueInterpretationMap( Map missingValueInterpretationMap) { diff --git a/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/StreamWriter.java b/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/StreamWriter.java index 4c4e5638d..a4223adb6 100644 --- a/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/StreamWriter.java +++ b/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/StreamWriter.java @@ -421,18 +421,6 @@ private void validateFetchedConnectonPool(StreamWriter.Builder builder) { } } - /** - * Sets the missing value interpretation map for the stream writer. The input - * missingValueInterpretationMap is used for all write requests unless otherwise changed. - * - * @param missingValueInterpretationMap the missing value interpretation map used by stream - * writer. - */ - public void setMissingValueInterpretationMap( - Map missingValueInterpretationMap) { - this.missingValueInterpretationMap = missingValueInterpretationMap; - } - /** * Schedules the writing of rows at the end of current stream. * @@ -861,6 +849,7 @@ public Builder setDefaultMissingValueInterpretation( * * @param missingValueInterpretationMap the missing value interpretation map used by stream * writer. + * @return Builder */ public Builder setMissingValueInterpretationMap( Map missingValueInterpretationMap) { diff --git a/google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1/StreamWriterTest.java b/google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1/StreamWriterTest.java index cd849fc50..87e1fe54b 100644 --- a/google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1/StreamWriterTest.java +++ b/google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1/StreamWriterTest.java @@ -1599,18 +1599,13 @@ public void testAppendWithoutMissingValueMap() throws Exception { testBigQueryWrite.addResponse(createAppendResponse(0)); - // The first append doesn't use a missing value map. ApiFuture responseFuture = writer.append(createProtoRows(new String[] {String.valueOf(0)}), 0); assertEquals(0, responseFuture.get().getAppendResult().getOffset().getValue()); - // Ensure that the AppendRowsRequest for the first append operation does not have a missing - // value map, and that the second AppendRowsRequest has the missing value map provided in the - // second append. verifyAppendRequests(1); - AppendRowsRequest request1 = testBigQueryWrite.getAppendRequests().get(0); - assertTrue(request1.getMissingValueInterpretations().isEmpty()); + assertTrue(testBigQueryWrite.getAppendRequests().get(0).getMissingValueInterpretations().isEmpty()); } } @@ -1625,7 +1620,6 @@ public void testAppendWithMissingValueMap() throws Exception { testBigQueryWrite.addResponse(createAppendResponse(0)); - // The first append doesn't use a missing value map. ApiFuture responseFuture = writer.append(createProtoRows(new String[] {String.valueOf(0)}), 0);